Solved

VB6 Get Text of Col 1 Row 1 in Datagrid

Posted on 2011-02-11
3
3,324 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

932 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

6 Experts available now in Live!

Get 1:1 Help Now