16,554
社区成员
发帖
与我相关
我的任务
分享
Private Sub dataGridAll_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dataGridAll.MouseDown
startIndex = e.Location.Y \ dataGridAll.Rows(0).Height - 1
End Sub
Private Sub dataGridAll_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dataGridAll.MouseUp
endIndex = e.Location.Y \ dataGridAll.Rows(0).Height - 1
Dim dt As New DataTable
dt = CType(dataGridAll.DataSource, DataTable)
Dim row As DataRow = dt.NewRow
For i As Integer = 0 To dt.Columns.Count - 1
row(i) = dt.Rows(startIndex)(i)
Next
dt.Rows(startIndex).Delete()
dt.AcceptChanges()
dt.Rows.InsertAt(row, endIndex)
dataGridAll.DataSource = dt
End Sub