In my project I've got 3 forms - main form, form with list of some object(in dropdownlist), form where i can add new object.
In main form I can invoke form with list of objects and form with add func. And I do it like this
Form2 f2 = new Form2(some_param);
f2.ShowDialog();
When f2 is opened I can see drop down list with objects and a button to add new object(using form with add func). In this dialog I decided to add new object
void click1(object sender,EventArgs e)
{
Form3 f3 = new Form3(some_param); // want to add new object and then show in dropdownlist
f3.ShowDialog();
radDropDownList1.Items.Clear(); // I close the form and catch here NullReferenceException
InitDropDown();
}
What's the problem? What causes NullReferenceException?
When I show form3 by pressing button on main form and then close - it works normal and main form doesn't catch any exceptions when form 3 is closed.