Hi
I have an
UltraNumericEditor and I Set minimum value to 1 maximum 999
But it allows us to enter manually using key board a value like 0
which it should not allow us at all when min and max values are set
And I press tab its stuck there for ever, is there any solution to avoid entering zero when minimum value is 1
help is appreciated
thanks and regards
venugopal darur
The mask idea did not work. Used the keyPress event. Why does the MinValue property not work? Just looking for a simple 1 through 10 numeric editor and had to add the following code:
Private Sub uneOneThruTen_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles uneOneThruTenKeyPress
Try
If (e.KeyChar = "0") Then
If (uneOneThruTen.Value <> 1 And uneOneThruTen.SelectionLength <> 0) Then
e.Handled = True
End If
Catch 'ignore errors
End Try
End Sub
Hi,
The cell value is not validated against the minimum until the user tries to leave the cell. It really has to be that way, because the grid can't know what the user is going to type next.
I guess in a case like this, there's no reason to allow the user to type a leading 0, but the grid doesn't have any functionality built in to stop them.
You might want to try applying a Mask to the column like "nnn". That might do what you need.
Oops. please ignore the above, for some reason, I thought this was a grid question.
What is the mask you are using? Try using "nnn" or "###' and see if that makes any difference. If not, then the only thing to do would be to try handling this yourself in KeyDown, maybe.