PasswordBox Method (Macro)
Opens a dialog box containing a prompt and a text box for user input, and returns the contents of the text box after the user clicks OK. The text entered into the text box appears as asterisks on screen. This method returns an error if the user clicks Cancel.
expression.PasswordBox( _
ByVal As String, _
ByVal As String _
) As String
where
expression is a variable that represents a
Macro Object
Parameters
- prompt
- The prompt string for the dialog box. The string limit is 260 characters; however, strings are automatically truncated in the dialog box display if they extend beyond the length of the box.
- title
- The dialog box caption. The string limit is 260 characters; however, strings are automatically truncated in the dialog box display if they extend beyond the length of the title bar.
Return Value
The string entered in the dialog's text box.
This example prompts for a password after the session connects and enters the user name and password.
To run this sample, copy the code to the ThisIbmTerminal code window.
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
Dim rcode As ReturnCode
Dim pw As String
'Prompt for a password
pw = ThisIbmTerminal.Macro.PasswordBox("enter your password", "password")
'Move the cursor to the user name field and put the user id in that field
rcode = ThisIbmScreen.MoveCursorTo1(20, 16)
rcode = ThisIbmScreen.PutText2("userid", 20, 16)
'Put the password in the password field
rcode = ThisIbmScreen.PutText2(pw, 21, 16)
'Enter the user ID and password
ThisIbmScreen.SendControlKey ControlKeyCode_Transmit
End Sub