2010-03-01 39 views

回答

9

我不确定充分,第一行的DataGridView的,如果所有这些行strictely必要的,但这应该工作:

If MyDataGridView.RowCount > 0 Then 
    MyDataGridView.ClearSelection() 
    MyDataGridView.CurrentCell = Me.Rows(0).Cells(0) 
    MyDataGridView.Rows(0).Selected = True 
End If 

啊,如果你要选择整行,DataGridView的选择模式属性必须是FullRowSelect

0
DataGridView.SelectedIndex = 0 
选择
1
DataGrid1.Rows(0).Selected = True