DRapp
DRapp

Reputation: 48169

WinForms C# DataGridView force refresh

Baby steps rolling... I have a form with a data grid bound to a table. I have some textboxes on the form bound to the table[columns], so as I scroll the grid, the textboxes show corresponding data.

I go to an "Edit Mode" of the textboxes and change the content and hit a save button. The grid doesn't refresh the changed context until I physically click in the cell which forces a call to the tables OnChanging and OnChanged events...

How can I FORCE whatever event to "flush" the table at the end of my edit and have it refreshed in the datagridview.

Thanks

Upvotes: 6

Views: 16817

Answers (2)

BFree
BFree

Reputation: 103760

Have you tried calling the dataGridView's Invalidate method?

this.dataGridView1.Invalidate();

Upvotes: 10

Jay Riggs
Jay Riggs

Reputation: 53603

Are you using a BindingSource? If so, call its EndEdit method on the TextBox's Leave event.

Upvotes: 1

Related Questions