给你写了个子程序供你调用,已调试通过。使用方法为SelectDgRow DataGrid1, 50,意思是选中控件DataGrid1的第50行并加黑,子程序代码如下:
Sub SelectDgRow(Dg As DataGrid, dRow As Long)
  '选中DataGrid控件Dg中指定行号dRow
  If Dg.ApproxCount < 1 Then Exit Sub  '没有记录退出
  Dg.Bookmark = 1                      '标记还原
  Dg.Row = dRow                        '选中需要的行
  While Dg.SelBookmarks.Count > 0
    '该循环清除不需要选中的行(对按Ctrl选中的多行进行清除)
    Dg.SelBookmarks.Remove (0)
  Wend
  Dg.SelBookmarks.Add Dg.Bookmark       '让选中的行变黑标记被选中
End Sub
										
					
	
	
	
	      
 
											







 
	    