One of the LearnQTP readers asked this question:

Hi Ankur,

I need help with Input Box .
When I enter password in Inputox( Wpass = InputBox(”EnterPassword”)) its showing up the “password” instead of “********” ..we need to prompt input box for a password and we need to hide a password while it is being typed.Do you have solution for this ? I googled it I came up with VBScript..Is it possible with InputBox Function..

Now, as far as I know this can’t be handled either by using the built-in InputBox function or by using Crypt method.

For those who still wonder about the applicability of DotNetFactory, you can use it here.
Using Example-11 from one of our earlier posts on DotNetFactory, you can modify it and add UseSystemPasswordChar method to make sure the entered characters are masked. This is what the modified code would look like

Set MyForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")

Set MyText = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms")

Set MyButton = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")

Set Pos = DotNetFactory.CreateInstance("System.Drawing.Point"
,"System.Drawing",x,y)

Pos.X = 90
Pos.Y = 100
MyText.Location = Pos
MyText.Width = 100
MyText.UseSystemPasswordChar = true
Pos.X = 100
Pos.Y = 130
MyButton.Location = Pos
MyButton.Text = "Close"
MyForm.Controls.Add MyText
MyForm.Controls.Add MyButton
MyForm.CancelButton = MyButton
MyForm.ShowDialog

Msgbox MyText.Text

Set MyText = Nothing
Set MyButton = Nothing
Set Pos = Nothing
Set MyForm = Nothing

True property under MyText.UseSystemPasswordChar = true will make sure that the entered characters are masked and are not visible to the user.

Run the above piece of code and let me know if this worked for you.