Question

I have a combobox bound to a database table. When the user inserts a new piece of data into the table, I want the combobox to be automatically updated to display this data, however I am unsure of how I would go about doing this.

Help would be greatly appreciated.

Was it helpful?

Solution

I have something similar to this in a program of mine.

Whenever my datagridview is updated, I empty the combobox and refill it.

Something along the lines of (I don't have my code available right now, but this is the general idea):

if (!combobox.isempty())
{
    combobox.clear()
}

// Fill combobox here

OTHER TIPS

i think, in the moment you know you add some data to this table, you should call:

yourcombobox.Databind();

also you must define yourcombobox.DataSource property again, before calling Databind()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top