Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

selected values from a datagrid in VB6

In VB6, is there a way to select a record from a datagrid and use the values in that record for coding.  For example, if you see the selected row in the attached image, I would like to use the values in the first few columns (Agency, ActivityName, etc...)  How would I select the values after the user has selected the row from the review grid?
image.jpg
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Something like MyDataGrid.Rows(1).Cells(0).Value
Avatar of al4629740

ASKER

Trying it now
Ok, so how would the program distinguish between a row selected vs. one that is not?
You can probably do this
MyDataGrid.Rows(MyDataGrid.Row).Cells(0).Value
Method or data member not found on this line where highlighted in bold


LocateDate = DataGrid1.Rows(DataGrid1.Row).Cells(3).Value

My guess is syntax?
The name of my Datagrid is datagrid1 so there is no error in the name of the grid.
DataGrid1.Rows(DataGrid1. SelectedRow).Cells(3).Value
DataGrid1.Rows(DataGrid1. SelectedRow).Cells(3).Value


Same error on the bold above
Would it be possible for you to create a zip file of your project (including the database if you're using one)  and attach it?
Sent
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give me some time on this and I'll report back.
Give me some time on this and I'll report back.
So what you gave me certainly works...I'm just trying to convert that to my application.  Its taking a little time.
I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2018
              Experts Exchange Top Expert VBA 2018