Validating text box
The approach is based upon extending the standard win forms text box control to allow storage of a regular expression and to provide the means to validate the text contained in the control against the pattern defined in the regular expression.The article further described how the extended text box control could be used in conjunction with an error provider to display meaningful information to the user if the control's validation function indicates a mismatch between the control's text and the regular expression provided with the control.
Other cultures will need different regular expressions here, and so it looks like some additional strategy would have to be developed to validate currency amounts across cultures.The first project is a class library called "Reg Ex Controls" which contains a class called "Reg Ex Text Box"; this class is an extended text box control that provides the means to store a regular expression and to test the text box text against the regular expression.The second project is a test windows form application called "Test Reg Ex Controls"; this project contains a single windows form that shows five examples of the extended text box control in use in conjunction with an error control. Error Provider Friend With Events txt Email As System.
Resume Layout(False) End Sub #End Region Private Sub txt Name_Validating(By Val sender As Object, By Val e As System.