07-12-2014, 10:18 PM
Hey dudes,
i got a problem with ma Listbox.
Im trying to acess the listbox from a nonstatic class, but i always get the error that something is null (object reference).
The Text cant be null cuz i set the string manually but seems like the Listbox is null i tried many diffrent ways but cant handle it.
Here some snippets;
/*--just for test--*/
MainForm frm = new MainForm();
frm.listBox1.Items.Add("xy");
/* throws error */
/*-- example --*/
frm.listBox1 = new System.Windows.Forms.ListBox();
frm.listBox1.Items.Add("TEST");
/* Dont throws an error but text still empty */
I also tried to call a method from the mainform to fill it still didnt worked.

