This Tutorial is all about How to Change Password Character in Runtime using VB.Net. In this tutorial you will be able to learn How to Change Password Character in Runtime using VB.Net. So lets get Started:
- First is open the Visual Basic, Select File on the menu, then click New and create a new project.
- Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK
- After that, design your form like this just like what I’ve shown you below.
Add a 2 label, 2 Textbox, and a Checkbox.
- Then add this Code to the Textbox.
[vbnet]
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
TextBox1.PasswordChar = TextBox2.Text
End Sub
[/vbnet] - Add this Code to the Checkbox.
[vbnet]
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.PasswordChar = “”
Else
TextBox1.PasswordChar = TextBox2.Text
End If
End Sub
[/vbnet] - Finally, Click F5 to run
Output