Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

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?
0
al4629740
Asked:
al4629740
  • 5
  • 4
1 Solution
 
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
 
al4629740Author Commented:
datagrid control 6.0
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
Bob HoffmanDeveloperCommented:
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
 
al4629740Author Commented:
Ok, so it does fire anyways after closing the form?  I didn't know that.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now