
Preventing multi-row selection in MSHFlexGrid?
The mshflexhgrid does not support multiple non-contiguous row selection. The
nearest you can come to it is set the highlight property to 'never' and then
on the appropriate event, change the cellbackcolor and cellforecolor
properties to give the appearance of selection.
Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim lngCurrentRow As Long
With MSHFlexGrid1
.FillStyle = flexFillRepeat
.SelectionMode = flexSelectionByRow
If Shift And vbCtrlMask = vbCtrlMask Then
If .CellBackColor = .BackColor Then
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
Else
.CellBackColor = .BackColor
.CellForeColor = .ForeColor
End If
Else
lngCurrentRow = .Row
.Row = .FixedRows
.Col = .FixedCols
.RowSel = .Rows - 1
.ColSel = .Cols - 1
.CellBackColor = .BackColor
.CellForeColor = .ForeColor
.Row = lngCurrentRow
.Col = .FixedCols
.ColSel = .Cols - 1
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
End If
End With
End Sub
Quote:
> Is there any way that you have found to select non adjacent rows? I want
> the users to be able to use the ctrl key to select multiple rows with the
> mouse by click on them and keep the rest of them selected. Shift works to
> do a group but only if they are adjacent.
> > Greetings,
> > Is there a way to prevent multi-row selection in an MSHFlexGrid? Didn't
> see
> > it as a property, but I might be overlooking it. I presume that you may
> have
> > to use some type of code triggered by LeaveCell() or EnterCell() that
> might
> > control this? Any ideas would be appreciated. I do have
ForceRowSelection
> > turned on.
> > Thanks,
> > Casey