Solved

update the datagrid

Posted on 2009-07-13
9
158 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 68
I need help embedding an image as HTML in my vb.net application 3 67
vbModal 12 51
Publisher:   Unknown     VB.exe Application 1 20
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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