OK. I've taken a quantum leap in my learning; I can now manipulate data pretty effectively using C# 2005 Express. I just hit a wall, though, and I need a little help, please.

I have a main form that contains a combo box bound to a field in the main table of a database. That combo box gets its selection list from another table (call it ListTable) in the database, and there is a second form (call it ListForm) that can be opened to allow the user to populate the ListTable manually. The problem is that when I add items to the ListTable from this ListForm, when I close the ListForm, the combo box selection list does not contain the newly added items; I have to close and relaunch the application for the updated items to appear.

What do I need to do to have the selection list for the combo box refreshed upon closing the ListForm, so that the newly added items are available immediately?

Hopefully someone can explain why this is happening as well as providing some code.

Thanks in advance.

OK!

Since I always want to be helpful (which is no more than right, since I try to GET so much help here), when I have found a solution to a problem I had, I share the answer for those who might have the same problem.

The solution was on this wise:

When the main form loads, the dataset is filled from the database (datasets exist only in memory). But, when I opened the ListForm to update the list of items, that info was saved back to the database, but not to the dataset. All I had to do was refill the dataset after updating the list.

To do this, I displayed the ListForm using ShowDialog(), and right after that, inserted a copy of the line that filled the dataset when the main form loaded. This way, as soon as I close the ListForm, the dataset is refilled, bringing in the new selections that now exist in the database. A simple enough thing for you veterans, but it made me literally jump up and down with excitement!

Hope that was explained clearly enough.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.