C# Custom control – TextBox accepting only numbers, decimal numbers, signed numbers

| | | | |

The creation of custom control using Visual Studio involves the following steps:

  1. Start Visual Studio;
  2. Create new “Windows Control Library” project;
  3. In the created project delete “User Control” file;
  4. Go to “Project” > “Add User Control” and give it a name;

    2016/07/29 21:38

C# Textbox - enter only positive numbers on KeyPress event in Windows form application

| | |

To prevent users from entering incorrect data in Windows form application, set restriction to allow only specific characters to be entered in the text box.

This example uses KeyPress event to monitor the users input and to apply the restriction required.

2016/07/22 18:16