Solved

VB6 Get Text of Col 1 Row 1 in Datagrid

Posted on 2011-02-11
3
3,159 Views
Last Modified: 2012-05-11


Hello Experts,

I am trying to make Label1.caption = Text of Col 1 Row 1 in Datagrid. When the app launches , datagrid1 is populated with 1 cell, as a result of a SQL query. I want the text of that cell to be label1's caption.

Thanx!
0
Comment
Question by:triphen
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
0
 

Author Comment

by:triphen
Comment Utility
Excuse my lack of knowledge on VB :)

I read the article but didn't understand much.

I am looking for a line of code similar to:

label1.caption = datagrid1.cell(0,0)
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
Comment Utility
What you can do is the following :

Private Sub Command_Click()
' hold the old value of selected row
   dim intOldRow as integer
   intOldRow = DataGrid.Row

' Now select your row (reminder: the first row is 0)
    DataGrid.Row = 2
' get the value from your colum
    test = DataGrid.Columns(0)

' set back to the selected row
   DataGrid.Row = intOldRow
End Sub


DataGrid.Row = 1
test = DataGrid.Columns(0)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now