Solved

VB6 Get Text of Col 1 Row 1 in Datagrid

Posted on 2011-02-11
3
3,773 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
[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 53

Expert Comment

by:Dhaest
ID: 34868885
0
 

Author Comment

by:triphen
ID: 34875748
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
ID: 34925601
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 91
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 81
Passing a Text Box name to a Sub 6 104
Create Files based on Cell Values in a Range in Excel 12 44
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

739 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