Control for entering phone number nt limited by length

Posted by: a.koneva on 10 May 2022, 1:09 pm EST

  • Posted 10 May 2022, 1:09 pm EST

    Hi
    I would like to create some textbox control in which user can enter only digits but not limited by length. How can I make it in C1? Should I use C1TextBox or something else?

    Best regards,
    Anna.
  • Replied 10 May 2022, 2:27 pm EST

    Hi Anna,

    You can use the C1TextBox for your requirement. To restrict the input to only digits, you can set the C1TextBox.CharCategory property to CharCategory.Number.

    Kind Regards,
    Kartik
  • Replied 10 May 2022, 9:35 pm EST

    Hi Kartik,
    Thank you for your answer, but it also enables entering space, but I would like to restrict it and enable only digits.

    Best regards,
    Anna.
  • Replied 10 May 2022, 10:29 pm EST

    Hi Anna,

    This behavior does not seem correct. We have reported it to the development team and will let you know as soon as we have an update. In the meantime, you can handle the KeyDown event of the C1TextBox to check if the Space key is pressed and set the SuppressKeyPress property of the KeyEventArgs to true. Kindly refer to the attached sample showing the same.

    Kind Regards,
    Kartik

    OnlyNumbers_C1TB.zip

    [C1WIN-27355]
  • Replied 13 May 2022, 2:01 pm EST

    Hi Kartik
    Thank you for your answer.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels