We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

keypress event in currency cells

Thread ID:





13725 May 7,2004 05:18 PM UTC May 7,2004 10:43 PM UTC WinForms 1
Tags: GridControl
Philip Bishop
Asked On May 7, 2004 05:18 PM UTC

I cant seem to make a keypress event in a currency cell work properly. I''ve done it in text cells fine. What i''m trying to do is i have a currency cell where the user can only enter one digit with no decimal and it can only be between 0 and 3. so i was trying to not let them enter any number greater then 3. so in testing i have tried many things and the following lastly. If Asc(e.KeyChar) = 49 Then e.Handled = False Else e.Handled = True End If so in this case i was trying to just allow them to enter a 1. i cant even make that work. before i had an if with all the values or an if of >= to 48 and <= 51 with no luck. As i said i''ve made textbox cells only accept say an "X" and that works fine. Am I doing something wrong or going about this wrong???

Administrator [Syncfusion]
Replied On May 7, 2004 10:43 PM UTC

I do not know a good way to do this. The main problem is the embedded CurrecnyEdit control actually processes the key stroke in its ProcessKeyMessage, and then triggers an event that you catch and cancel, but by that time the key has already made it to the cell. I think the simplest thing to do is to use a standard TextBox for this cell. If all you is to allow 1 digit of 1, 2 or 3, you can handle CurrentCellValidateString and easily impose this requirement.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon