When sending a value from a textbox in form2 to a listbox in form1,
I am getting a NullReferenceException error.
The handler code is:
public void button1_Click(object sender, EventArgs e) {
ListBox LB = Application.OpenForms["Form1"].Controls["Project_list"] as ListBox;
LB.Items.Add(Project_name.Text);
}
What is going wrong in it?
Only for demo purposes… Check this code, set a breakpoint and see what happens.
This is just an example to see what’s wrong with your code!