Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Dynamic Combobox - refresh list items on the fly

$
0
0
I have a main form where the user selects a customer from a drop down box. On this form is also a button that opens another form as a dialog that allows the user to enter a new customer. The user clicks "Save" on the new customer dialog and the customer is saved to the database and the main form becomes active again. I can't figure out how to update the combobox so that it displays this new customer in the list.

The combobox is bound to a datasource. I know the code to create and save a new customer is working since the change is reflected in the database. The new customer also appears in the combobox BUT only after I close and run the application again.


// if a new customer was added to the database/dataset refresh combobox since there should be a new item
if (result == DialogResult.OK)
{
// code to refresh combobox should go here

}

Viewing all articles
Browse latest Browse all 2535

Trending Articles