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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft FlexGrid Selection - One Row ??? 2

Status
Not open for further replies.

cj92713696

Programmer
Nov 23, 2000
105
US
I'm using the MSFlexGrid in my VB app. and I want to limit my flexgrid to only display one row at a time. I've selected the SelectionMode property to "1 - By Row" at design time and programmatically set the SelChange() event to Grid.RowSel = Grid.Row to simulate only selecting a single row. The problem I'm having specifically is that when I use the mouse and hold down the left button, I can momentarily select multiple rows. When I release, only the first row is selected per the SelChange() event. I would like for multiple rows to not be selected, even on the mousedown event and to somehow override mousedown over the flexgrid or even disable mousedown altogether. Is this possible?

Thanks,
CJ
 
Although the multiple row selection will flash momentarily when the user tries the normal Windows multiple selection (click on a row, hold the shift key down and click on another row) these routines will give you what you need:

Private Sub fg_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
fg.Redraw = False
End Sub

Private Sub fg_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
fg.RowSel = fg.Row
fg.Redraw = True
End Sub


Mark
 
Mark, I could kiss you right now!!!

:)

Thanks a lot!!!

Very much appreciated!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top