Results 1 to 9 of 9

Thread: How To Display Selected FlexGrid Data in a Label [RESOLVED]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    76

    How To Display Selected FlexGrid Data in a Label [RESOLVED]

    Attempting to make a graphical input for form data. So I populate a 132x60 grid with data from the form. When I select/highlight I want to be able to display what I selected in a label.

    So If

    12345678901234567890
    ABC Company

    So If select cols 3 through 13. I want the label to display "ABC company" is this possible?
    Last edited by scimini; Apr 8th, 2003 at 02:30 PM.

  2. #2
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489

    this is similar

    This is similar to what you want.

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim RowIndex As Integer
    3.     Dim ColIndex As Integer
    4.    
    5.     With Me.MSHFlexGrid1
    6.         For RowIndex = 0 To .Rows - 1
    7.             For ColIndex = 0 To .Cols - 1
    8.                 .TextMatrix(RowIndex, ColIndex) = RowIndex + ColIndex
    9.             Next
    10.         Next
    11.     End With
    12. End Sub
    13.  
    14. Private Sub MSHFlexGrid1_Click()
    15.  
    16.     With Me.MSHFlexGrid1
    17.         If .Col > .FixedCols - 1 And .Row > .FixedRows - 1 Then
    18.             Me.txtMagnify.Text = .Text
    19.             Me.txtMagnify.Visible = True
    20.             Me.txtMagnify.Left = .Left + .CellLeft + ((.CellWidth - Me.txtMagnify.Width) / 2)
    21.             Me.txtMagnify.Top = .Top + .CellTop + ((.CellHeight - Me.txtMagnify.Width) / 2)
    22.         End If
    23.     End With
    24.  
    25. End Sub
    26.  
    27. Private Sub MSHFlexGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    28.     With Me.MSHFlexGrid1
    29.         If Me.txtMagnify.Visible = True Then
    30.             If .MouseCol <> .Col Or .MouseRow <> .Row Then
    31.                 Me.txtMagnify.Visible = False
    32.             End If
    33.         End If
    34.     End With
    35. End Sub
    36.  
    37. Private Sub txtMagnify_Click()
    38.     Me.txtMagnify.Visible = False
    39. End Sub
    40.  
    41. Private Sub txtMagnify_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    42.     Me.MousePointer = vbDefault
    43. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    76
    Sort of, I do not need to float the textbox, it can be stationary. And where does the value of the selection get displayed. From looking at the code, it will only work one time?

  4. #4
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489
    just comment out the movement code.

    It reacts to the mouseclick, whatever
    you click on is displayed in the textbox

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    76
    Is there a way to get it to display the entire selection and not just the cell that was clicked.

    Let me explain a little better. Each Letter has its own cell. So "ABC Company" comprises 11 cells. It is basically a 1 letter to 1 cell relationship. I need to selected all 11 cells and have the characters basically combined to create the original string.

  6. #6
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489
    Loop through all columns in the selected
    row and place the value in the Text box
    instead of the .Text property.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    76
    The loop is the problem. I now how to find the start of the selection, how do I find the end. ColSel gives me the start, how do I find the end.

  8. #8
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489
    .col i think.........

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    76
    That was it, thanks.

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