Jav*_*ier 10
我不确定所有这些线是否都是严格必要的,但这应该有效:
If MyDataGridView.RowCount > 0 Then
MyDataGridView.ClearSelection()
MyDataGridView.CurrentCell = Me.Rows(0).Cells(0)
MyDataGridView.Rows(0).Selected = True
End If
Run Code Online (Sandbox Code Playgroud)
啊,如果要选择整行,DataGridView选择模式属性必须是 FullRowSelect