?
Solved

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

Posted on 2016-11-24
3
Medium Priority
?
78 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Karen earned 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

765 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