• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

restricting user to select multiple row on Flex Grid

Is there a way to restrict user to select multiple rows on Flexgrid.
My requirement is that at a time user can selct only one row on FlexGrid.
I tried disbling Shift key down, but i failed.
Can you anyone help me in this.

1 Solution
VijayKAuthor Commented:
This Q is really importamnt, i didn't have enough point to post as important.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Which FlexGrid?
If it's M$ simple felxgrid, you have a property SelectionMode, which is 0 (Free) by default. Change it to 1 (By Row), and your problem should be solved.

Try setting the FlexGrids SelectionMode to "flexSelectionByRow".
Then, in the grids SelChange event, put <your flexgrid name>.RowSel = <your flexgrid name>.Row

This might achieve what you want.
As mentioned already set selectionmode to flexSelectionByRow.  Then use mouseup or keypress if you want to be sure of cursor movements too.  RowColChange does nothing and selchange gave me a buffer overflow if i tried selecting from a higher row downwards.

Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  MSFlexGrid1.Row = MSFlexGrid1.RowSel
End Sub
I dont want to cause trouble but angellll's answer will not give you what you want so why has it been accepted ?

All altering the selection mode does is force selection of he entire row rather than one cell, it does not prevent multiple row selections whereas my answer did.  Which I believe was your requirement in the first place.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now