次のエラーが表示されます。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