Solved

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

Posted on 2016-11-24
3
48 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 67
VBS file using code from 2nd file (txt or vbs) 4 42
VB6 - Convert HH:MM into Decimal 8 63
Collapse and expand table in Word 2010 2 37
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

827 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