我遇到了拖车问题。丢弃代码。每当我点击column name
时,我的程序都会出错。
我在Datagridview1_mousedown Event
这是我的代码:
Private Sub Datagridview1_MouseDown(sender As Object, e As MouseEventArgs) Handles Datagridview1.MouseDown
SourceRowIndex = -1
If e.Button = Windows.Forms.MouseButtons.Left Then
SourceRowIndex = Datagridview1.HitTest(e.X, e.Y).RowIndex
Datagridview1.Rows(SourceRowIndex).Selected = True
Datagridview1.Refresh()
DoDragDrop(Datagridview1.Rows(SourceRowIndex), DragDropEffects.Move)
End If
End sub
我在这段代码中得到错误:
Datagridview1.Rows(SourceRowIndex).Selected = True