I’m working on a form to add new Customers. In this form the users selects an adress in a combobox (cbbAdress).
There’s also a “new” button next to the adress combobox, which opens up a new form.
frmAdres frmAdres = new frmAdres();
frmAdres.Show();
In this form the users can add a new adress.
When they close the form, the combobox (cbbAdress) doesn’t update (obviously).
I am wondering how I could make the combobox (cbbAdress) on the main form update?
Thanks,
Thomas
Change you code to something similar below:
obviously you will need to ensure you set the DialogResult to OK on your address form when the Save button is clicked, and add a property to the frmAddress form to read the selected address.
If you click close on the form and Dialog result is not ‘OK’ then the code in the ‘if’ block will not get hit.
Placing the form in a ‘using’ brace will also dispose of it after it leaves the context of the brace which will means you cant forget about disposing of it.