Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

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?
Avatar of Bob Hoffman
Bob Hoffman
Flag of United States of America image

Is this vb6? What DataGrid control are you using?
Avatar of al4629740

ASKER

The basic grid, not the Flex Grid.  This is vb6
datagrid control 6.0
If your talking about Component Ones TrueGrid you would simply ReBind the grid to your data source.
 
how do i do that?
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.
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
ASKER CERTIFIED SOLUTION
Avatar of Bob Hoffman
Bob Hoffman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, so it does fire anyways after closing the form?  I didn't know that.