block negative number

how can i block -ve key press in  SfNumericTextBox control. event i tried to handle keydown or keypress which also not works.

can you please suggest me how to handle -, minus .which in some case i dont want.

regards

raman kumar


3 Replies

SN Sudharsan Narayanan Syncfusion Team January 24, 2022 01:55 PM UTC

Hi Raman,

You can be able to achieve the “Block Negative number” requirement by setting the MinValue as Zero and Validation on KeyPress to SfNumericTextBox in Form designer as given in the below code snippet.


Code Snippet:

 
sfNumericTextBox1.MinValue = 0; 
sfNumericTextBox1.ValidationMode = Syncfusion.WinForms.Input.Enums.ValidationMode.KeyPress; 

Please check the above code and let us know your concerns. We are happy to assist you.

Regards,
Sudharsan



SI singh January 26, 2022 12:45 PM UTC

thanks a lot ,  Sudharsan ji


issue has been resolve. its working now.



SN Sudharsan Narayanan Syncfusion Team January 27, 2022 06:01 AM UTC

Hi Raman,

 
We are glad to know that your issue has been fixed. Please let us know if you need any other assistance. We are happy to assist you.

Regards,
Sudharsan
 


Loader.
Up arrow icon