If you are working with the system that still uses InputBox control from MS VisualBasic then you may get a situation where the input needs to be validated. InputBox control does not allow any validation checks and in ideal case needs to be replaced with custom WinForms dialog box. This post will show a simple way of validating InputBox by creating InputBoxValidated function and using IStringValidator interface.
As you can see InputBoxValidated function uses IStringValidator interface that can implement any kind of string validations and criteria.
Below is an example of StringValidator class that implements IStringValidator interface and makes use of StringValidator from System.Configuration.
References: