What could be the problem?
I get this message:
An object reference is required to access non-static member labb3.linkClass.getLinks()
namespace labb3
{
public partial class visalinks : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
userClass newUser = (userClass)Session["userClass"];
ArrayList Poster = linkClass.getLinks();
foreach (object o in Poster) {
linkClass lnks = (linkClass)o;
Response.Write(lnks.webbadress);
}
}
}
}
linklClass is name of your class, and getLinks is a method in this class – but getLinks isn’t static, so in order to use it – you have to create instance of the class:
or… just make getLinks static, if it’s possible.