Click here to Skip to main content
15,947,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok VB.NET gurus, this vb.net rookie needs your expertise how to 'refresh' a datagrid.

BACKGROUND:
Form1 has a Datagrid, Dataset1 created by drag DB into datagrid.
Form2 presents the record selected from the datagrid. Within the LOAD_FORM I search the DB with the “Key” and place data in Dataset2 (DS created manually)

CHALLENGE:
Record updated in Form2 is saved in DB fine and when Form2 is closed, record updated does not appear in Form1.

I’ve tried the following but no sucess
In form1 closing event I’’ve got the code to load data into the DS
Me.TUSERSTableAdapter.Fill(Me.PTDataSet.TUSERS)


What should I do to see the datagrid finally updated?
Posted
Updated 25-Jul-11 15:39pm
v2

1 solution

The easy way to do it is to just set the DataSource of the DGV again. You might have to set it to Nothing first.

But, of course, this depends on what you're binding the DGV to. Your code for this looks like .....??
 
Share this answer
 
v2
Comments
victorpc553 27-Jul-11 20:17pm    
ok but I drag the Dataset from the tool box to the DGV, so are you refering to do the entire dataset definitions by manual coding? If so can you please provide examples about this.
Dave Kreskowiak 27-Jul-11 22:18pm    
I never use the designer generated stuff because it generates a ton of code noobies don't understand. It hides a lot of details that new people need to move on.

After your Fill statement in your original post above, try this:

myDataGrid.Refresh
myDataGrid.Parent.Refresh

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900