Update on databound datagrid not updating


Here is that code: also, when you press your "INSERT" or "ADD" into table button, you need to load your table again (go again through this select * from .... And, you need to do that every time you make a change to your table!!!Caveat: this answer assumes the Data Gridview is a simple single independent one, no parent Data Gridview (related table). If I click on the changed cell, or minimize then maximize the window it updates properly, but I need it to happen automatically. ..I'd really like to avoid this as it makes the scrollbar pop back to the top, and means that I'd have to set my cell background colours again. I've tried Refresh (as well as refreshing the parent), Update, and Invalidate, but they're not doing what I need. MSDN should contract with Stack Overflow to do their code examples; Microsoft's leave a lot to be desired ("Here is one line of code that doesn't really help you...") It sounds as your Change Object notification is not triggered / handled correctly. I had the same problem earlier, but in that situation I had to change the cell's background colour at the same time that the value changed. I've seen this problem mentioned on a few message boards, but haven't seen a working answer to it yet. I personally always use the Binding Source object when binding to a data Grid View. After entering data into all the textbox, and after clicking the submit button, it won't immediately show in the datagridview, I need to reopen the form in order to see the new inserted row.

Configuration; namespace GRP_02_03_SACP I have no errors already by following your code.

I have a Data Grid View bound to a Binding List (C# Windows Forms).

If I change one of the values in an item in the list it does not immediately show up in the grid.

In my case, I have a method that return the values for two columns that I have on my datagridview.

But the datagrid still doesn't refresh after I insert a record. @user3222297 So, in that Method That Return List() you can build a List (List is a class) with all the items you need.

That way if the user resizes a column it won't toss out their change on refresh. My recommendation: If you have ownership of the datasource, don't use a List. The Binding List has events that fire when items are added or changed, and the Data Grid View will automatically update itself when these events are fired.

You must have an account to comment. Please register or login here!