Fawad
Fawad

Reputation: 153

How to refresh ComboBox data (Form-1), after updating Data Grid View Data(Form-2)

ComboBox is data-bound to "Quality Setup Table"

ComboBox: Display Members "Quality Code: 401, 402, 403 etc."

When I open Form 2 - (DataGridView), perform changes and Close. new updated data doesn't reflect in ComboBox.

I have to close application and restart to see the newly added data in ComboBox.

What should I do to update ComboBox Data with Newly Added/Removed Data in Data Grid View after Closing Form 2.

Upvotes: 0

Views: 523

Answers (2)

Fawad
Fawad

Reputation: 153

I have found solution to my own problem.
In order to update ComboBox with New Data.

Write this in form 1.

Form2 form2 = new Form2();

form2.showDialog(); // it must be show dialog only not show.

// below here write code that fills data into comboBox // you can find this code in Form1_Load. // once that is done. Your comboBox will begin updating data whenever Form2 Closes.

Upvotes: 0

Nitin Alapati
Nitin Alapati

Reputation: 79

Did you try ComboBox.DataBind() when you are updating DataGridView ?

I think you can Find the control from the form and invoke the DataBind() method to refresh the Items of the ComboBox. Hope this helps

Upvotes: 0

Related Questions