Page 1 of 1
Complex Password Field, Please help
Posted: Sun Mar 27, 2011 3:31 am
by noobcake
Hello, I am making something where you can log into it, but what i want it to do is at the start there are two text boxes, In the first one i want there to be in grey text "Username" and the second "Password". and when you click on the box to type in it, the whole text will be deleted and you will be typing, But when you are typing I want the text to be black. So when its default "Username" it will be grey but when you type it will be Black. And in the password Field I want it the same except when you type it is in Passwordchar "*". The problem I had was that when i had password char on it would make the text "password" into ******** as-well. I don't want that, i want it to be "Password" until you type.
So I want it to be like this..

then this when you type in it:
I want it to be like this. I don't want to have labels above the textboxes saying Enter password:
Thanks in advance

Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 3:40 am
by Bogoh67
ok well
1. first off make the textboxes as in the 1st picture
2. then click the username textbox and
3. click on the events tab on the properties dialog,
4. look for mouseclick,
5. double click it and type this code
6.
Code: Select alltextbox1.text = nothing
textbox1.forecolor = black
7. then do thiis for textbox2 but make sure its on mouseclick event
8.
Code: Select all textbox2.text = nothing
textbox2.forecolor = black
Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 3:43 am
by Napster1488
Thats is really Easy...here is the Code it also includes when Typing into the Password Field then it starts to show the Password as a Dot
Code: Select allPrivate Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
If TextBox1.Text = "Username" Then
TextBox1.Text = ""
End If
End Sub
Private Sub TextBox2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Click
If TextBox2.Text = "Password" Then
TextBox2.Text = ""
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.ForeColor = Color.Black
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
If TextBox2.Text = "Password" Then
Else
TextBox2.ForeColor = Color.Black
TextBox2.UseSystemPasswordChar = True
End If
End Sub
Change TextBox1 and 2 ForeColor to Gray and when Typing it will set it to Black with this Code...
Dont forget to give +rep if this was helpfull ;)
Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 5:43 am
by noobcake
<3 you guys. Thanks so much

. I am new to Visual basic and i really want to get into it.

Thanks so much.
My fake msn login is ready now :P. thanks soo much. +Rep for all
Spot the fake :P
One more question

. I don't think its actually possible but can you make a msg box or something that looks like a message box and looks like this
Because I just have a msg box that looks like that without the picture, the man and the Windows Live, Messenger 2011. Thanks guys for what you have already done

Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 7:37 am
by MrAksel
Spotted! The 'Options' link is in the wrong place ^^
But, you could add a new form to your project and make it look like the message box, then when you want to show it, instead of using Show() use ShowDialog()
Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 7:43 am
by noobcake
MrAksel wrote:Spotted! The 'Options' link is in the wrong place ^^
But, you could add a new form to your project and make it look like the message box, then when you want to show it, instead of using Show() use ShowDialog()
Ooooo True that :P. Thanks for pointing that out and the help

.
UPDATE:
I have moved the Options

.
Thank you very much for the point about using a second form. It works exactly right now its COMPLETE! tis awesome now :P
Re: Complex Password Field, Please help
Posted: Sun Mar 27, 2011 8:12 am
by noobcake
========== LOCKED ===============
I have locked this thread because I have got the answers I wanted, Thank you all

cooll;
You are all angel; , You are helping me on my way to become good at Visual basic