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

Getting the Value from a Cell in a DataGrid

This is a easy one if you know your DataGrids.

I currently have a ADO Data Control 6.0 and a DataGrid Control 6.0 on one of my forms.

I am trying to access the value of a single cell in the Activity_ID field when the cursor is next to it.

The only way I have figured out how to do this so far is through the use of bookmarks as the Initial Query loads I make every row a bookmark.

 For I = 0 To DataGrid1.VisibleRows - 1
   DataGrid1.SelBookmarks.Add (DataGrid1.RowBookmark(I))
 Next I

 I click a Command Button coded as.....

Dim intENum

intENum =

Label6.Caption = intENum

So, MY QUESTION is,  can you get this value without the use of bookmarks????

Thank you so much for whoever answers this.

1 Solution
This is how you do it

    intENum = adodc1.recordset("Activity_ID").value

Anthony PerkinsCommented:
If you know for sure that the cell has not been changed then normulap's solution would work, otherwise you can use the following:

intENum = CLng(DataGrid1.Columns.Item("Activity_ID ").Text)

Hi wmetz@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Split points between: nomulap and acperkins@devx

wmetz@devx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.

CS Moderator

nomulap: points for you at http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20328655
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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