I've created a program in Console, but have now decided to create the program using Windows Forms. I imported all the class from the Console.
Am trying to populate the list of Form Load but am having trouble doing it, probably the way am doing it, but it seems a good way for me because I don't get mixed up in large application so am trying to make it work.
Form 1:
private void Form1_Load(object sender, EventArgs e)
{
Utilities.Load();
Utilities.DisplayList();
}
Other Class:
{
Form1 x = new Form1();
foreach (var item in ListOfBooksBook)
{
x.listBox1.Items.Add(item.PrintItem);
}
}
As you can see I just want to plug in methods from other classes into Form1, but have all the work happening in the other class keeping my form1 nice and neat :)
The above code doesn't work because its not allowing me to access listbox1.