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!

Mulitselect MSFlexgrid??

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
Is it possible to retrieve all the rows which are selected by the user??

i'm wanting to delete all the rows which the user selects, but i can only delete one row :(

Any ideas?
 
The trick is to not use the index of the row to remove the item since the bounds of the index changes after the removal. You can remain on the first selected row and continue to remove rows until you've reached the last selected row:

Code:
Private Sub fg_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim i As Integer
    Dim j As Integer
    Dim c As Integer
    
    i = fg.Row ' first row selected
    j = fg.RowSel ' last row selected
    
    While c <= j - i ' itterate through the selection
        fg.RemoveItem (fg.Row)
        c = c + 1
    Wend
End Sub


Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top