Results 1 to 2 of 2

Thread: How do you tell what cell you are over in a MSFlexGrid on MouseMove?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    Just a quick question...how would you tell which cell you are over in a MSFlexGrid in a MouseMove event?

    Can you get the specific row and col?

    Thanks for the help

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    MSFlexGrid has two properties that you would want to look at.
    MouseCol and MouseRow

    These will give you the row and column that the mouse is over. So, in this example, drop a label on the form and use this code:

    Code:
    Private Sub Form_Load()
        Dim i As Integer
        Dim j As Integer
        
        With MSFlexGrid1
            .Cols = 10
            .Rows = 10
            For i = 0 To 9
                For j = 0 To 9
                    .TextMatrix(i, j) = "Text" & i & j
                Next
            Next
        End With
    End Sub
    
    
    Private Sub MSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        
        With MSFlexGrid1
            Label1.Caption = .TextMatrix(.MouseRow, .MouseCol)
        End With
    End Sub
    Moving the mouse on the grid will show you the text from the cell which has the mouse over it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width