我收到此错误:Argument 'Expression' cannot be converted to type 'DataGridViewRow'.
我不知道这意味着什么或如何解决它,它发生在这一行:
dt2.Rows(Val(selectedItem))("Position") = dt.Rows(selectedItem.Cells(1).Value)("Mouse Position")
有人可以解释一下错误是什么以及如何解决吗?
Try
If selectedItems Is Nothing Then
For n = 0 To dt.Rows.Count - 1
dt2.Rows.Add(n)
dt2.Rows(n)("Position") = dt.Rows.Item(n)("Mouse Position")
Next
Else
For Each selectedItem As DataGridViewRow In selectedItems
dt2.Rows.Add(selectedItem)
dt2.Rows(Val(selectedItem))("Position") = dt.Rows(selectedItem.Cells(1).Value)("Mouse Position")
Next
End If
Catch ex As Exception
MsgBox("Error", MsgBoxStyle.Exclamation, "Error!")
End Try