>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only