c# listbox problem
#1

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.



Messages In This Thread
[No subject] - by Nikolee - 07-12-2014, 10:18 PM
[No subject] - by Nikolee - 07-14-2014, 04:05 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)