asked on
Private Sub PrintSelectedUserID()
Dim userID As Integer
If frmMain.DataGridView.SelectedRows.Count = 0 And frmMain.DataGridView.RowCount = 0 And frmMain.DataGridView.SelectedCells.Count = 0 Then
MessageBox.Show("Update not allowed as no row/cell is selected!", ".NET Remoting Sample", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
'If cell only is selected, use this to find the UserID
If frmMain.DataGridView.SelectedRows.Count = 0 And frmMain.DataGridView.SelectedCells.Count > 0 Then
userID = CType(frmMain.DataGridView.Rows(frmMain.DataGridView.SelectedCells(0).RowIndex).Cells("UserID").Value, Integer)
'If full row is selected, use this to find the UserID
ElseIf frmMain.DataGridView.SelectedRows.Count > 0 And frmMain.DataGridView.SelectedCells.Count > 0 Then
userID = CType(frmMain.DataGridView.Rows(frmMain.DataGridView.SelectedCells(0).RowIndex).Cells("UserID").Value, Integer)
End If
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY