On a datagrid, I have columns request quantity and grant quantity.
If user enters grant qty greater than request quantity, I want to display
message "Grant Qty cannot be greater than Request Qty" and clear grant qty value and put the focus on that column.
I tried setting grant qty to be dbnull.value, but it's not working.
What's the proper way to do this? I would be thankful.
If grdDetails.CurrentCell.ColumnNumber = 6 Then
Dim reqQty As Decimal = grdDetails.Item(currentRow, currentColumn - 3)
Dim tb As TextBox = GetEmbeddedTextBox(dgcc.ColumnNumber)
If Not (tb Is Nothing) Then
Dim oldValue As String = Me.grdDetails(dgcc).ToString()
Dim newValue As String = tb.Text
If newValue <> oldValue Then
If newValue < reqQty Then
blnGrntQtyIsChanged = True
Else
grdDetails.Item(currentRow, currentColumn) = DBNull.Value
MsgBox("Grant Qty cannot be greater than Request Qty", MsgBoxStyle.Information)
End If
End If
End If
End If
If user enters grant qty greater than request quantity, I want to display
message "Grant Qty cannot be greater than Request Qty" and clear grant qty value and put the focus on that column.
I tried setting grant qty to be dbnull.value, but it's not working.
What's the proper way to do this? I would be thankful.
If grdDetails.CurrentCell.ColumnNumber = 6 Then
Dim reqQty As Decimal = grdDetails.Item(currentRow, currentColumn - 3)
Dim tb As TextBox = GetEmbeddedTextBox(dgcc.ColumnNumber)
If Not (tb Is Nothing) Then
Dim oldValue As String = Me.grdDetails(dgcc).ToString()
Dim newValue As String = tb.Text
If newValue <> oldValue Then
If newValue < reqQty Then
blnGrntQtyIsChanged = True
Else
grdDetails.Item(currentRow, currentColumn) = DBNull.Value
MsgBox("Grant Qty cannot be greater than Request Qty", MsgBoxStyle.Information)
End If
End If
End If
End If