Solved

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

Posted on 2016-11-24
3
15 Views
Last Modified: 2016-11-25
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
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…
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…

744 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

8 Experts available now in Live!

Get 1:1 Help Now