Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert password to * 3

Status
Not open for further replies.

chilly442

Technical User
Jun 25, 2008
151
US
Is there a way to get a text box to show * , rather than the actual password that is typed? In VBA, you can set the PasswordChar property to *. How do you do this in VB?

Thanks for the help!
Chilly442
 
Did you even look at the properties available for a text box in VB.Net? You kind of answered your own question.
 
In VBA, you can set the PasswordChar property to *

It's exactly the same in VB.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
When I select the textbox and view properties, there is no PasswordChar property. Am I missing something? I have 2005 on my machine.
 

Are you sure you have just basic TextBox on your Form?

You can always do:
Code:
    Private Sub Form1_Load(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) _
                           Handles MyBase.Load
        TextBox1.PasswordChar = "*"
    End Sub

Have fun.

---- Andy
 
It is just a basic text box that I pulled in from the Toolbox. Is there a setting that I need to get the PasswordChar Property?

Andy's code gives me an error:
PasswordChar is not a property of Textbox.

Makes me think that I have a setting off somewhere.

Thanks,
Chilly442
 
To help debug this issue, temporarily add this code (changing the name to match the name you gave your text box)

Code:
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		MessageBox.Show(TypeName([!]TextBox1[/!]))
	End Sub

I'm guessing this will return something other than "TextBox". Let us know.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
It returned TextBox.

Now what?

Thanks,
Chilly442
 
Is this on a form or is it a WebControl TextBox? If it's the latter, look at the TextMode property.

I'm sorry I was so snippy in my original post. The original question looked like a "What year was the War of 1812 fought?" type of question. After all these years I should know by now, things aren't alway what they seem with computers.
 
"What year was the War of 1812 fought?"

[wavey] Oh, oh... I think I know this one.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
No sorry needed. It does seem like a "noob" question, and I knew when I typed it in that I was going to get "DUH". It seems like one of those until you can't find what you are looking for.

It is a WebControl TextBox, and the TextMode property took care of what I needed.

I expected it to look like it does in VBA with the PasswordChar property. I didn't look at the TextMode property.

Thanks again for your help!
Chilly442

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top