NET Password Generator
ValidPassword Method
Example 



KellermanSoftware.NetPasswordGenerator Namespace > PasswordGenerator Class : ValidPassword Method
Ensure the password is valid
Syntax
'Declaration
 
Public Function ValidPassword( _
   ByVal password As String _
) As Boolean
'Usage
 
Dim instance As PasswordGenerator
Dim password As String
Dim value As Boolean
 
value = instance.ValidPassword(password)
public bool ValidPassword( 
   string password
)
public:
bool ValidPassword( 
   String^ password
) 

Parameters

password

Return Value

True if valid
Example
//Licensed Mode
//PasswordGenerator generator = new PasswordGenerator("User Name From Receipt", "License Key From Receipt");
 
//Trial Mode
PasswordGenerator generator = new PasswordGenerator();
 
//Set the desired configuration
generator.Config.MinNumbers = 1;
generator.Config.MaxNumbers = 2;
generator.Config.NumberPosition = Position.Center;
generator.Config.ValidSpecialCharacters = "@#$";
generator.Config.MinSpecialCharacters = 1;
generator.Config.MaxSpecialCharacters = 1;
generator.Config.SpecialCharacterPosition = Position.Center;
generator.Config.MinUpperLetter = 1;
generator.Config.MinLowerLetter = 1;
generator.Config.MinWords = 2;
generator.Config.MaxWords = 3;
generator.Config.WordStyle = WordStyle.PopularWords;
generator.Config.MinLength = 15;
generator.Config.MaxLength = 20;
generator.VerifyConfiguration();
 
//This will be an invalid password
string invalidPassword = "a";
 
if (!generator.ValidPassword(invalidPassword))
{
    Console.WriteLine(generator.GetPasswordMessage());
}
'Licensed Mode
'PasswordGenerator generator = new PasswordGenerator("User Name From Receipt", "License Key From Receipt");
 
'Trial Mode
Dim generator As New PasswordGenerator()
 
'Set the desired configuration
generator.Config.MinNumbers = 1
generator.Config.MaxNumbers = 2
generator.Config.NumberPosition = Position.Center
generator.Config.ValidSpecialCharacters = "@#$"
generator.Config.MinSpecialCharacters = 1
generator.Config.MaxSpecialCharacters = 1
generator.Config.SpecialCharacterPosition = Position.Center
generator.Config.MinUpperLetter = 1
generator.Config.MinLowerLetter = 1
generator.Config.MinWords = 2
generator.Config.MaxWords = 3
generator.Config.WordStyle = WordStyle.PopularWords
generator.Config.MinLength = 15
generator.Config.MaxLength = 20
generator.VerifyConfiguration()
 
'This will be an invalid password
Dim invalidPassword As String = "a"
 
If Not generator.ValidPassword(invalidPassword) Then
    Console.WriteLine(generator.GetPasswordMessage())
End If
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PasswordGenerator Class
PasswordGenerator Members