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
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.
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.
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."
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.
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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for