Vb net datagrid not updating

So, I have this WPF datagrid, and it's quite happy in the way it works. Some background, I'm not doing the base behavior for editing/adding, but rather have a separate control outside the grid which is responsible for that behavior (as it is also the control responsible for adding the initial element).But I was having a problem, and it was with the Grid's UI.My changes and additions were not making their way into the UI display.No matter how many times I invalidated the User Interface it just would not get displayed.And this was not just for Updates, but also for Inserts and Deletes. But, I wouldn't be here if I didn't have a solution. Invalidate UI command, as that's basically what I was trying to do: repaint the grid.What I wasn't doing with that was telling the Datagrid to look at the underlying datasource and refresh the UI from that. Yeah, I did feel a bit silly after finding that out.Of course I blame it on the fact that I've spent too much time in the ASP.NET arena where I can force a data-rebinding by calling the Data Bind method of the object.

' Delete row from Data Grid View Try Master Data Set. Show("Could not remove item") End Try ' Update Paint Stock Table Adapter Try Me. Show("Update Failed") End Try I am using Visual Studio 2010 and have my insert query built in the dataset design view under the appropriate table's table adapter. INSERT INTO `Paint Stock` (`Paint Number`, `Paint Name`, `Location`, `m L`, `Date In`, `Additive 1`, `Additive 2`, `Additive 3`, `Notes`, `New Bucket`) VALUES (? Close() Msg Box("Update Successful") Catch ex As Exception Message Box. ' Create new row for Paint Stock Dim ps New Row As Data Row ps New Row = Me. Attached is the code that is ran when the insert button is clicked.

Upon closing the application however it does exist in the database and can be manipulated.

Please or register to post comments
If spammers comment on your content, only you can see and manage such comments Delete all
The usual way of doing this is to reset the DataSource of the DataGridView. Try like this code with correct code to provide the right table from the dataset dataGridView1. DataSource = typeofList; dataGridView1. DataSource = dataset. Tables"your table";. Calling. Refresh doesn't work since it only forces. 
19-Feb-2019 23:57

Vb net datagrid not updating introduction

Vb net datagrid not updating