Selecting data from MSHFlexGrid vb6

Posted on 2007-10-12
Last Modified: 2008-01-09
Hello all,

This issue is driving me nuts as it should be simple:
I want to select a cell of retrieved data and have it displayed in a textbox.
I have a form with a MSHFlexGrid that uses Adodc to pull data from a SQL table (select title form titles).
The results of the query show up in the MSHFlexGrid as they should and the data will display in the textbox. However, no matter which cell I choose only the 1st (top) row will display in the textbox. I am using the following:

Private Sub MSHFlexGrid1_Click()
txtTitles.Text = Adodc1.Recordset.Fields("title")
End Sub  

Thanks in advance for your help.

Question by:webquests
    1 Comment
    LVL 18

    Accepted Solution

    txtTitles.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row,0)

    This will display the text in 1st Column and the selected row. Change the column number in the last argument if you want text from some other column.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    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…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now