Solved

How to set the row selection as it was prior leaving the datagrid in vb6

Posted on 2016-11-24
3
33 Views
Last Modified: 2016-12-24
We have a  form that has a datagrid.  When the user double-clicks on the desired row, the apps open  secondary form to work with.   We hold the row the user double-clicked on:

Private Sub grdDataGrid_DblClick()
 HoldDatagridRow = grdDataGrid.Row
 'instructions
 'instructions
 'instructions
End Sub

Open in new window


When the secondary form is finish, the control returns to the main form's datagrid.

Since the secondary form manipulates the data via SQL that is being displayed in the main form's datagrid, we refresh it prior prior user returns to it:

frmForm1.Refresh
frmForm1.grdDataGrid.Refresh
frmForm1.dcAdodcConnect.Refresh

Open in new window


When all is done, we use this line to place the control in the row of the main's datagrid as it was when the user double-clicked on it:

grdDataGrid.Col = HoldDatagridRow 

Open in new window


But it doesn't work.  The control always returns to the top of the main datagrid display.

Please advice on how to set the control to the row prior the user left it.
0
Comment
Question by:rayluvs
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Karen earned 500 total points
ID: 41901036
Firstly, I hope you just made a mistake when you said
grdDataGrid.Col = HoldDatagridRow

because it should be
grdDataGrid.Row = HoldDatagridRow

:)

Try adding
grdDataGrid.Row = HoldDatagridRow
grdDataGrid.SetFocus
0
 

Author Comment

by:rayluvs
ID: 41901153
Ha Ha Ha!  Yes made a mistake... ok will try.
0
 

Author Comment

by:rayluvs
ID: 41901988
Yes! Worked!
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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

932 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

12 Experts available now in Live!

Get 1:1 Help Now