Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 960
DRapp Avatar asked Mar 26 '09 03:03

DRapp


People also ask

Is C# a winform?

A Windows form in C# application is one that runs on the desktop of a computer. Visual Studio Form along with C# can be used to create a Windows Forms application. Controls can be added to the Windows forms C# via the Toolbox in Visual Studio. Controls such as labels, checkboxes, radio buttons, etc.

Should I still use WinForms?

Compared to WPF, WinForms has much better design-time experience in Visual Studio. This itself is enough to choose WinForms. This is my experience with WinForms and WPF. However, you can choose the appropriate technology as per your requirements.

What is WinForms for?

Introduction. Windows Forms is a UI framework for building Windows desktop apps. It provides one of the most productive ways to create desktop apps based on the visual designer provided in Visual Studio. Functionality such as drag-and-drop placement of visual controls makes it easy to build desktop apps.


1 Answers

Have you tried calling the dataGridView's Invalidate method?

this.dataGridView1.Invalidate();
like image 142
BFree Avatar answered Nov 04 '22 19:11

BFree