# SelBookmarks

Posted by 小吴 on January 06, 1998 at 16:39:31:

In Reply to: selbookmark posted by 小贤 on January 04, 1998 at 19:28:38:

SelBookmarks 传回的型别是 Variant。范例在线上说明已经写得很清楚了。要知道有多少列被选取可由 SelBookmarks.Count 属性中得知。其中所存放的 bookmark 可由编号 0 至 SelBookmarks.Count - 1 中取得。

Sub DeleteRows()
Do Until DBGrid1.SelBookmarks.Count = 0
Data1.Recordset.Bookmark = DBGrid1.SelBookmarks(0)
Data1.Recordset.Delete
Data1.Refresh
Loop
End Sub

下面这段程式功能相同，都是把所选的记录给删除。
Sub DeleteRows()
Dim i As Integer
For i = DBGrid1.SelBookmarks.Count - 1 To 0 Step -1
Data1.Recordset.Bookmark = DBGrid1.SelBookmarks(i)
Data1.Recordset.Delete
Next i
End Sub

Follow Ups: