2010-03-01 47 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