A ComboBox keeps disappearing on my windows form.
The first time i open the form its there, when i hide it (the form) and open it again, its gone. I guess it has something to do with the datasource it is connected to, but i dont know how to fix it.
When the form is made visible, the following function is executed (only necessary code included):
public void SetVisible(SomeClass s)
{
prog = s; //prog is a variable available in the form-class
my_cbx.DataSource = prog.GetItems() //my_cbx is the combobox
ShowDialog();
}
when the form is closed (hidden) the following funtion is called:
private void CloseForm()
{
prog = null; //this is for safety
Hide();
}
First i thought that the problem was "prog = null;", but even whithout it the same happend. Other comboboxes on the form wich have their items initialized when the form is created don't have this problem. The items of the combobox in question needs to be initialized each time the form is shown, as they will change depending on the object of SomeClass passed on in the SetVisible method.
The first time i open the form its there, when i hide it (the form) and open it again, its gone. I guess it has something to do with the datasource it is connected to, but i dont know how to fix it.
When the form is made visible, the following function is executed (only necessary code included):
public void SetVisible(SomeClass s)
{
prog = s; //prog is a variable available in the form-class
my_cbx.DataSource = prog.GetItems() //my_cbx is the combobox
ShowDialog();
}
when the form is closed (hidden) the following funtion is called:
private void CloseForm()
{
prog = null; //this is for safety
Hide();
}
First i thought that the problem was "prog = null;", but even whithout it the same happend. Other comboboxes on the form wich have their items initialized when the form is created don't have this problem. The items of the combobox in question needs to be initialized each time the form is shown, as they will change depending on the object of SomeClass passed on in the SetVisible method.