Forum Discussion

Patrice's avatar
Patrice
Contributor
14 years ago

MSFlexGridWndClass: How to select Cells or Rows

Hi,



I have lots of MSFlexGridWndClass Controls in my application and so far i have been able to:



'Get number of rows

MyRows = MyMSFlexGridWndClass.rows



'Get number of cols

MyCols = MyMSFlexGridWndClass.cols


'Get Data in Cell

MyCell = MyMSFlexGridWndClass.TextMatrix(x,x)





BUT i dont know how to:



-  Select a cell, cells

-  Select a row, rows



Thanks for your help,

Patrice

3 Replies

  • This is a built in control that ships with VB6. As such you can access the MSDN Library help files for VB6. I see some properties for you to investigate



    ColSel - Returns or sets the start or end column for a range of cells

    RowSel - Returns or sets the start or end row for a range of cells



    Col, Row Properties (MSHFlexGrid)



    Returns or sets the coordinates of the active cell in an MSHFlexGrid. These properties are not available atdesign time.



    Syntax



    object.Col [=number]

    object.Row [=number]



    Col, Row, Text Properties (MSHFlexGrid) Example

    This example puts the word "Here" into the current cell, changes the active cell to the third cell in the third row and puts the word "There" into this new active cell. To run the program, press f5, and then click the grid.



    Note   If you are using the MSFlexGrid, substitute "MSHFlexGrid1" with "MSFlexGrid1."



    Private Sub Form1_Load ()

       MSHFlexGrid1.Rows =8

       MSHFlexGrid1.Cols =5

    End Sub



    Private Sub MSHFlexGrid1_Click ()

       ' Put text in current cell.

       MSHFlexGrid1.Text ="Here"

        '   Put text in third row, third column.

       MSHFlexGrid1.Col =2

       MSHFlexGrid1.Row =2

       MSHFlexGrid1.Text ="There"

    End Sub



    I don't know if this helps, but if you can get a copy of the MSDN Library, that probably would.



    I am not super familiar with this particular grid...



    Good luck.
  • Thanks Lane.



    I found some properties that i can use.



    Thanks again,

    Patrice