'點到表頭會出錯
If DataGridView1.CurrentRow.Index <> -1 Then
End If
'改成
If DataGridView1.CurrentRow IsNot Nothing Then
Endif
'確定是否點選到DataGridView的某行資料列 [C#]
if (this.DataGridView.SelectedRows.Count != 0) {}
參考:
C# datagridview selectionchanged event error
You're likely getting this error because its trigger the event when it's not a valid selection (ie. -1) thus throwing this exception.
DataGridView - EditOnEnter
環境:
VS 2008
.Net 3.5
沒有留言:
張貼留言