Discussion Locked

VB 6.0: Selecting Row 0 in MSHFlexGrid

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an MSHFlexGrid with FixedRows = 1 (I use row 0 for column headers). When I click on any cell in row 0 VB reacts as if I clicked on row 1 (e.g., MyGrid.Row = 1) instead. If I change the value of FixedRows to 0, then clicking on any cell in row0 causes VB to react correctly that I clicked on row 0. How do I preserve FixedRows = 1 but ignore click events on cells in row 0?

I do have a tedious workaround in mind. Create another grid consisting of a single row of column headers and place it just above my existing grid. Set its FixedRows = 1. Then remove the row of column headers from my original grid. Then set the original grid's FixedRows = 0. Yukh!

I've looked high and low on the internet but can't find any reference to this problem as a bug. Any ideas?

1 reply

by miles.felton

In the case you have column headers...If you click on a data cell then no range is selected and the RowSel value is the row on which you clicked. If you click a header then the column is selected and the RowSel value is equal to the number of rows, while the Row is 1. Of course this doesn't help when there is only one row, but then one row and all rows are the same thing logically and it is assumed that clicking on the heading means you wish to treat the whole thing.
If you have row headings then use ColSel instead. The functionality of this control is derived from earlier ones. OK?

This discussion is closed to new replies.