I have a winform with a combo box thats filled from a query in the database. If I add a field to the database, the new field won't show up in the form until I close it and reopen it.
I was able to put in a MessageBox.Show() and once that popped up, I closed it, and saw the new data in the combo box.
EDIT:
Let me clarify a bit. I have a dropdown combo box, and that is populated by a table adapter. I just did the databinding with the GUI so I'm not sure how it works.
What I want is, I want the new data that I enter to be refreshed when I come back to it. I have a seperate window to manage the data, and then I close it I want the combo box to be updated with what I just saved.
Is this possible? I tried to do it on form load but that doesn't work either, I think because the form is already loaded.
The Refresh method is not for that. What you want to achieve is refreshing the data binding. This would be sth like this:
cb.DataBindings[0].ReadValue();
Another way is using a data source that supports change notification. Such a data source fires ListChanged event with appropriate parameters to trigger update of controls that are bound to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With