update the datagrid

On the close event, I want to make sure my datagrid has all the data updated with the database.  What code do I need to do this?
al4629740Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Bob HoffmanConnect With a Mentor DeveloperCommented:
No, you need to deal with the update on a row by row basis. When the grid is updated and the user moves off the row the _AfterUpdate event fires. In thisevent you would check for a change edit the data and update your database. If the user makes a change then closes the form the _AfterUpdate event still fires.
0
 
Bob HoffmanDeveloperCommented:
Is this vb6? What DataGrid control are you using?
0
 
al4629740Author Commented:
The basic grid, not the Flex Grid.  This is vb6
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
al4629740Author Commented:
datagrid control 6.0
0
 
Bob HoffmanDeveloperCommented:
If your talking about Component Ones TrueGrid you would simply ReBind the grid to your data source.
 
0
 
al4629740Author Commented:
how do i do that?
0
 
Bob HoffmanDeveloperCommented:
If your talking about refreshing the grid based on the data in the database changing your would do this:
DataGrid.Refresh
DataGrid.ReBind

If your talking about update the database based on data changing in the grid you would use the _AfterUpdate event and update the database from the changed column values.
0
 
al4629740Author Commented:
I want to update based on data changing in the grid.  Would this work after closing the screen?

Private Sub Form_Unload(Cancel As Integer)
DataGrid.ReBind
End
End Sub
0
 
al4629740Author Commented:
Ok, so it does fire anyways after closing the form?  I didn't know that.
0
All Courses

From novice to tech pro — start learning today.