How to Hide Text in an InputBox in VBScript

Written by lora covrett
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Hide Text in an InputBox in VBScript
A password is required to access virtually all online applications. (Creatas/Creatas/Getty Images)

The most common type of field to be hidden in Visual Basic is a password field. Nearly all programs display "" as each letter of the password is typed. This is to prevent anyone from easily seeing your password. It does not encrypt your password in the computer; it merely hides it from view as it's being typed. Visual Basic has a built-in property to mask the password input box with ""; however, VBScript does not. When running a VBScript file in Windows XP or Windows Server 2003, there is a built-in COM object, "ScriptPW," that will mask the password.

Skill level:
Moderately Challenging

Other People Are Reading


  1. 1

    Declare a reference to a new WScript object. The "CreateObject" method is used to create the reference. "InternetExplorer.Application" can be passed to the "CreateObject" method to have the Visual Basic script launch an "html" form where the user will input their password.

  2. 2

    Declare a variable in the script to hold the password value. "IEObject.Document.Body.All.MyPassword.Value" retrieves the value of the field named "MyPassword" from the "html" form.

  3. 3

    Define the field "MyPassword" with input type of "password" in the "html" file. The word "password" is what hides the password text and displays a single black dot for each letter. Create a "Login" button for the user to click after they have typed their password. In the "OnClick" event of this button, code "RunScript."

  4. 4

    Set other properties of the password field in the "html" file such as "maxlength," "defaultValue" and "size." These properties help with password validation on the user's end. For example, if the password is required to be at least eight characters, the "maxlength" or "size" properties can be coded to trigger an error to the user if they attempt to type beyond that limit.

  5. 5

    Determine the next action in the Visual Basic script when the user has entered a correct password. Usually, a new screen will be displayed with the user's personal information. One place where this type of "html" and Visual Basic scripting is used is when you log in to a website to view a bill. The security validation is much more complex than what is described here, but the concept of how the password field is displayed is the same.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.