Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi select in grid
Message
From
23/10/1997 06:01:16
 
 
To
17/10/1997 06:54:45
General information
Forum:
Visual C++
Category:
Troubleshooting
Miscellaneous
Thread ID:
00055115
Message ID:
00056276
Views:
46
>How can I in DBGrid or MSFlexGrid determine which multi rows are selected?
>Lets say I have 10 rows, rows 1,3,5 are selected. How can i retrive this data from the grid control?
>Even better, how can i determine which row is selected at all? If i select only 1 row, how do i know which
>one is selected?
>
>Alesh

Hi,
The rows selected in a grid can be found out by the bookmarks property of the grid. The following code will clarify the things to you

Dim selbkmrk As Variant
Dim nTotalDelRows As Integer
dim grdVal as variant

nTotalDelRows = grd.SelBookmarks.Count
selbkmrk = grd.SelBookmarks(i)

For i = 0 To nTotalDelRows - 1
selbkmrk = grd.SelBookmarks(i)
For j = 0 To grd.Columns.Count
If grd.Columns(j).CellValue(selbkmrk) <> "" Then
grdval = grd.Columns(j).CellValue(selbkmrk)
endif
next j
next i

where grd is the name of the grid.

This code I have tried for the Sheridan data grid and I suppose it should work with the DBGrid and MSFlexGrid also.

Manika
Previous
Reply
Map
View

Click here to load this message in the networking platform