In this turtorial, I will teach you how to set your Textbox to "show" and "hide" Password in the User Rgistration Form by using Visual Basic 2008. This will help you determined the password that you have input in the Textbox when registering in the User Registration Form.
So let’s begin:
Open the Visual Basic 2008 and create a new Windows Form Application. After that, do the Form just like this.
Double click the checkbox and do this following code in the method.
'CHECKING IF THE CHECKBOX WAS CHECKED OR NOT.
If CheckBox1.CheckState = CheckState.Checked Then
'IF TRUE, IT SHOW THE TEXT
txtpass.UseSystemPasswordChar = False
Else
'IF FALSE, IT WILL HIDE THE TEXT AND IT WILL TURN IT INTIO BULLETS.
txtpass.UseSystemPasswordChar = True
End If
Go back to the design views, double click the form and do this following code in the
Form_Load
.
'HIDE THE TEXT OF THE TXTPASS ON THE FIRST LOAD
txtpass.UseSystemPasswordChar = True
These are the full codes that you have made.
Public Class Form1
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
'CHECKING IF THE CHECKBOX WAS CHECKED OR NOT.
If CheckBox1.CheckState = CheckState.Checked Then
'IF TRUE, IT SHOWS THE TEXT
txtpass.UseSystemPasswordChar = False
Else
'IF FALSE, IT WILL HIDE THE TEXT AND IT WILL TURN INTO BULLETS.
txtpass.UseSystemPasswordChar = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'HIDE THE TEXT OF THE TXTPASS ON THE FIRST LOAD
txtpass.UseSystemPasswordChar = True
End Sub
End Class
Now, press F5 to run your project.