Public Shared Function GetRow(ByVal theGrid As DataGridView) As DataRow
GetRow = Nothing
If theGrid IsNot Nothing Or theGrid.DataSource IsNot Nothing Then
Dim drv As DataRowView = CType(theGrid.CurrentRow.DataBoundItem, DataRowView)
GetRow = CType(drv.Row, DataRow)
End If
End Function
Don’t forget to handler the exception if the dataBoundItem is nothing with the NullReferenceException
c39db91e-e7a6-444a-93e6-8fab10cab8e5|0|.0