• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 104
  • Last Modified:

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

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
rayluvs
Asked:
rayluvs
  • 2
1 Solution
 
KarenAnalyst programmerCommented:
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
 
rayluvsAuthor Commented:
Ha Ha Ha!  Yes made a mistake... ok will try.
0
 
rayluvsAuthor Commented:
Yes! Worked!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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