This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PasswordBox Method (Macro)

Hi All,

According to the doco  the PasswordBox method returns an error if user presses Cancel.

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.

Any ideas as to how to trap the error if the user presses Cancel? I just get a zero-length string returned.

What I am trying to do is determine if the user pressed cancel or entered a blank password and pressed Ok and make a decision on that..

Any ideas appreciated.





  • Verified Answer

    Hi Steve,

    I see the dilemma you mention in my test environment.  The returned value is the same for clicking OK with a blank message box or clicking cancel.  I am trying to see if there is a way to work around it, but at this time I see it as a limitation of the method.


    Jeff B

  • Verified Answer

    Hi Steve,

    I was able to follow up on this and confirm that the only return value for that method is the input.  You could code the user into a loop for a few rounds and customize the dialog to let them know the information is required to login or you can create your own dialog in VBA where you can monitor the dialog buttons.

    hiddenTextEntry = ibmCurrentTerminal.Macro.PasswordBox("Password is required to sign on", "Mainframe password")

    You can contact Customer Support to open a feature request to add this functionality.