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?

Improve company productivity with a Business Account.Sign Up

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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.