Assigning value to a label or textbox for row.,col selected from msflexgrid

Posted on 2004-11-04
Last Modified: 2013-12-25
HOw would I display the value of row, col seected in a label?
Question by:zachvaldez
    LVL 48

    Expert Comment

    x = MSFlexGrid1.RowSel
    Mydata = MSFlexGrid1.Textmatrix(x,2)

    text1.text = MyData
    label1.caption = mydata

    Expert Comment


      all you have to do is assign the textbox's text property or labels caption property to that of the MSFlegrids Rowsel proerty.
    LVL 11

    Expert Comment

    Private Sub MSFlexGrid1_SelChange()
        Label1.Caption = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col)
    End Sub
    LVL 11

    Accepted Solution

    Or this if you want currently selected Row/Col values

    Private Sub MSFlexGrid1_SelChange()
        Label1.Caption = "Row:" & MSFlexGrid1.Row & _
                      "   Col:" & MSFlexGrid1.Col & _
                      "   Val:" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col)
    End Sub

    .Row and .Col are more "precise" than .RowSel and ColSel

    If you select multiple cells, then Row/Col will point to cell where you began selecting (where you pressed mouse button), and RowSel/ColSel will point to cell where you released mouse button.
    The cell where you began is actualy your current cell, not the last.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    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…
    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 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…
    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…

    754 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