I have this if else statement that I need help with. What I would like to happen is the user enters a number in data grid view columnIndex 0. If the first validation (If CheckSatus(chkValue)) fails turn the back color red and stop. If its valid I want to continue to CheckRelease(chkValue). Right now if its invalid it goes to CheckRelease(chkValue) and change the back color yellow.
Current Code: Private Sub gridUserEntries_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles gridUserEntries.CellLeave 'Validate Release Number is validate and that Release is in F4 screen
If (e.ColumnIndex = 0) Then
Dim currCell As DataGridViewCell = gridUserEntries.CurrentCell
Dim chkValue As String = currCell.GetEditedFormattedValue(currCell.RowIndex, DataGridViewDataErrorContexts.Display)
If Not (chkValue.Trim = "") Then
'Validate if release is in jobscopedb.IPJOBM table
If CheckSatus(chkValue) Then
currCell.Style.BackColor = Color.White
Else
currCell.Style.BackColor = Color.Red
btnUpdatePPUSRFS.Enabled = False
btnClear.Enabled = True
End If
'Validate if the Release Number is in the PPUSRFS TABLE
If CheckRelease(chkValue) Then
currCell.Style.BackColor = Color.White
btnValidate.Enabled = True
btnRetrieve.Enabled = True
btnClear.Enabled = True
Else
currCell.Style.BackColor = Color.Yellow
btnInsertPPUSRFS.Enabled = True
btnValidate.Enabled = False
btnRetrieve.Enabled = False
End If
Else
currCell.Style.BackColor = Color.White
End If
End If
Aucun commentaire:
Enregistrer un commentaire