Solved

update the datagrid

Posted on 2009-07-13
9
157 Views
Last Modified: 2012-05-07
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
Comment
Question by:al4629740
  • 5
  • 4
9 Comments
 
LVL 8

Expert Comment

by:Bob Hoffman
ID: 24842808
Is this vb6? What DataGrid control are you using?
0
 

Author Comment

by:al4629740
ID: 24842823
The basic grid, not the Flex Grid.  This is vb6
0
 

Author Comment

by:al4629740
ID: 24842893
datagrid control 6.0
0
 
LVL 8

Expert Comment

by:Bob Hoffman
ID: 24843084
If your talking about Component Ones TrueGrid you would simply ReBind the grid to your data source.
 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:al4629740
ID: 24843109
how do i do that?
0
 
LVL 8

Expert Comment

by:Bob Hoffman
ID: 24843408
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
 

Author Comment

by:al4629740
ID: 24843481
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
 
LVL 8

Accepted Solution

by:
Bob Hoffman earned 250 total points
ID: 24843555
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
 

Author Comment

by:al4629740
ID: 24846002
Ok, so it does fire anyways after closing the form?  I didn't know that.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now