KeyChain.AddPassword

From Real Software Documentation

Jump to: navigation, search
Method
KeyChain.AddPassword ( kci as KeyChainItem, Password as String )

Adds the password to the Keychain and associates it with a KeyChainItem.

If it fails, it generates a KeyChainException.

Example

The following example adds a KeyChainItem for an application and assigns a password.

Dim NewItem as KeyChainItem
If System.KeyChainCount > 0 then

NewItem = New KeyChainItem
'Indicate the name of the application
NewItem.ServiceName = "MyApplication"

'Create a new keychain item for the application and assign the password
System.KeyChain.AddPassword NewItem, "SecretPassword"
Else
Beep
MsgBox "You don't have a key chain."
End if

Exception err as KeyChainException
MsgBox "Can't add item: " + err.Message
Personal tools