0

i'm working on coding of login form program using visual studio 2012 and SQL server 2012.

the function i want is this: when i type the password during login the password will show "*" instead of the password.

what is the coding to do that?

my login form:

Public Class Form2

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BackColor = Color.LightGray
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ClassSiswa.namadatabase = "KPIRWAN"
        Dim caridata As SqlClient.SqlDataReader
        caridata = ClassSiswa.CariDataPengguna(ClassSiswa.opencon, TextBox1.Text, TextBox2.Text)
        If Not caridata.Read Then
            MsgBox("Nama dan Sandi Tidak Terdaftar")
        Else
            Me.Hide()
            Form1.Show()
        End If
        ClassSiswa.closecon()
    End Sub

End Class
1
  • 1
    Did you check the PasswordChar property of textbox? Check this Commented May 11, 2015 at 7:46

3 Answers 3

3

enter image description here

See this photo?? after you click your textbox once, go through the Properties box and look for the PasswordChar and type the asterisk(*) symbol. And when you run the program and type the password, providing that the textbox of your password is the same textbox where you typed the asterisk symbol under its properties, it will show asterisk instead of the words inputted.

Or you can simply type this under your form_load

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    TextBox1.PasswordChar = "*"
End Sub
Sign up to request clarification or add additional context in comments.

Comments

2

So you want showing the text on your textbox to somethink like "****", right?
Assumption your textbox2 is textbox for input password...
just put this code to your load Event

TextBox21.UseSystemPasswordChar = True

or you can right click on textbox2 -> click properties -> then in properties windows, set UseSystemPasswordChar to True...

Comments

0
  • Add TextMode="Password" as given under in html page

    <asp:TextBox ID="TextBox2" runat="server" TextMode="Password" >
    

1 Comment

This 8 year old question is for a System.Windows.Forms.TextBox, not an ASP.Net TextBox. The TextMode property is not available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.