AskPassword, AskPassword$ (functions)

Syntax

AskPassword[$](prompt$ [,[title$] [,helpfile,context]])

Description

Returns a String containing the text that the user typed.

Comments

Unlike the AskBox/AskBox$ functions, the user sees asterisks in place of the characters that are actually typed. This allows the hidden input of passwords.

The AskPassword/AskPassword$ functions take the following parameters:

 

Parameter

Description

 

prompt$

String containing the text to be displayed above the text box. The dialog box is sized to the appropriate width depending on the width of prompt$. A runtime error is generated if prompt$ is Null.

 

title$

String specifying the title of the dialog. If missing, then the default title is used.

 

helpfile

Name of the file containing context-sensitive help for this dialog. If this parameter is specified, then context must also be specified.

 

context

Number specifying the ID of the topic within helpfile for this dialog's help. If this parameter is specified, then helpfile must also be specified.

 

When the dialog box is first displayed, the text box has the focus.

A maximum of 255 characters can be typed into the text box.

 

Function

Returns

 

AskPassword$

text typed into the text box, up to a maximum of 255 characters. A zero-length string is returned if the user selects Cancel.

 

AskPassword

String variant. An Empty variant is returned if the user selects Cancel.

 

If both the helpfile and context parameters are specified, then a Help button is added in addition to the OK and Cancel buttons. Context-sensitive help can be invoked by selecting this button or using the help key (F1 on most platforms). Invoking help does not remove the dialog.

 

s$ = AskPassword$("Type in the password:")

Example

Sub Main()

  s$ = AskPassword$("Type in the password:")
  MsgBox "The password entered is: " & s$
End Sub

See Also

MsgBox (statement); AskBox$ (function); InputBox, InputBox$ (functions); OpenFilename$ (function); SaveFilename$ (function);  SelectBox (function); AnswerBox (function).

Notes

The text in the dialog box is displayed in 8-point MS Sans Serif.

More information

A