Form1 is a type but used like a variable [on hold]



I'm having a problem accessing my ListBox1 inside a class.



public static void LoadLists(Form1 f1)
{
string path = "//Employees.meta";
var doc = XDocument.Load(path);
var items = doc.Descendants("Employees");
var query = from x in items

select new
{
Name = (string)x.Element("Name"),
Gender = (string)x.Element("SubData")
.Element("Person")
.Element("Gender")
};

foreach (var item in query)
{
f1.listBox1.Items.Add(item.Name);
}
}


This compiles fine, but inside the API when using LoadLists(Form1 f1) it shows error Form1 is a type but used like a variable


Help would be appreciated, thanks


No comments:

Post a Comment