Regular Expression (as detailed in VBHelp) will probably provide the easiest answer for checking after the event.
If you are checking a typed entry in a textbox, then validate each keystroke in the keypress event by comparing KeyAscii with allowed values - you'll still need to check in the validate event in case the user cut&pasted
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
There are a number of solutions. Here's one using Regular Expressions: [tt]
' Add a reference to Microsoft VBScrip Regular Expressions library Private Function TestISIN(strTest As String) As Boolean
With New RegExp
.Pattern = "^\w{2}\d{10}$"
TestISIN = .Test(strTest)
End With
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.