Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS FLexGrid

Status
Not open for further replies.

tk7834

Programmer
Jul 9, 2002
15
US
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.

Thanks
 
Depending on your selection mode, you can use the Col and Row properties to determine the active row, column or cell. Thanks and Good Luck!

zemp
 
I'm not sure what you meant by that (forgive me, I'm new to FlexGrids). Do you have a quick code example maybe?
 
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!

zemp
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top