I'm looping through records in a flexgrid and need to be able to see if one is highlighted or not. If it's highlighted, I need to get the value out of one of the cells. I thought it was .SelectionMode, but it doesn't seem to be working.
In order for a row to be highlighted it has to be selected. When you click on a row it will highlight and set the row property.
For example, if you highlight the fourth row of data by clicking the cell in the first column then you can determine which row , column and cell was highlighted with this code.
intRow=msflexgrid1.row
intCol=msflexgrid1.col
The specific cell is cell(introw, intcol).
How you accomplish this also depends on how the data gets into your grid. Personally I don't like to bind the data to my controls, I find that placing the data in arrays and then filling the grid with the data gives me more flexibility.
If you are really new to the flex grid then do some searches on this and other forums, as well as the msdn. You will find the asnwers to a lot of your questions without having to wait for replies. Thanks and Good Luck!
With FlexGrid
'Select column with wanted data
'this will select the cell which is in the row of the highlighted cell and the 2nd column
.Col = 2 'Serial No column
cellValue = Val(.text)
End With
Regardless of the active cell and/or the selection mode, you can always use the .TextMatrix property.
Value = grdGrid.TextMatrix(anyrow, anycol)
grdGrid.TextMatrix(anyrow, anycol) = Value
Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.