gibbo1715

Hi All

can anyone point me in the direction of how i can ensure my users useNumbers, chars and *./ etc in their password please

eg Password1.

thanks

gibbo




Re: Visual Basic Express Edition password string question

^Philipp^

just use some of the String-Namesprace's functions to check for the chars you want to be there (and how many times etc.): Contains, IndexOf, IndexOfAny, ToCharArray, Char/Substring, Split, Replace, etc. you can always find a way to work with these.
Personally - if I'd only want to make sure 1 of those specials chars is in the password - would be

If Password.IndexOfAny(new Char() {"*"c,"\"c,"."c}) > -1 Then 'Password is ok






Re: Visual Basic Express Edition password string question

Derek Smyth

Hi gibbo....

Your best bet is to use regular expressions... you can get some regular expression that validate strong passwords here

http://regexlib.com/Search.aspx k=password

Here's an example of how to use....

Code Snippet

Private Sub TextBox1_Validating(ByVal sender As System.Object, _

ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating

If System.Text.RegularExpressions.Regex.IsMatch(Me.TextBox1.Text, _

"( =^.{8,30}$)( =.*\d)( =.*[a-z])( =.*[A-Z])( =.*[!@#$%^&*()_+}{"":;' />.<,]).*$") = True Then

'strong password

Else

'bad password

End If

End Sub

Edit: Sorry Philipp thats twice I've re-answered your posts, we must be posting at the same time.






Re: Visual Basic Express Edition password string question

gibbo1715

Sorry chaps been away for a couple of days

Just wanted to say thankyou , that was exactly what i needed

Gibbo