Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
341
UltraCalculatorDropDown (version 8.1) Allows Invalid Characters
posted
When the calculator is not dropped down the field allows entry of non-numeric characters.  Particularly problematic is that it allows multiple decimals (i.e. 3..4)   I have a solution that works (basically tap into the value changed event/strip out invalid characters), but it's a real hack.  Is there a better way to block invalid characters?
  • 71886
    Offline posted

    Hello Jeff Staddon,

    Another approach to achieve this might be the following:

     

            private void ultraCalculatorDropDown1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (!char.IsNumber(e.KeyChar))
                    e.Handled = true;
            }
    

     

    You could modify the code to fit your requirements.

    Please do not hesitate to contact us if you need any additional assistance.