Windows Forms provides several ways for you to validate input in your application.
If you need to require users to enter data in a well-defined format, such as a telephone number or a part number, you can accomplish this quickly and with minimal code by using the Masked Text Box control.
For example, cryptography and a strong authentication protocol can help prevent attackers from capturing someone's login credentials and sending those credentials as input to the program.
Eavesdropping attacks are often easy to launch, but most people don't worry about them in their applications.
Instead, they tend to worry about what malicious things can be done to the machine on which the application is running.
note that this function examines only ONE char, not an entire bunch of them.
It is always good practice to resort to already-built functions; there are intricacies you might not be aware of even in the simplest task, and this will make you a good programmer overall.
Most people are far more worried about active attacks than they are about passive attacks.