Question:

In visual basic how to create a username and a password?

by  |  earlier

0 LIKES UnLike

I'm clarissa, I need help please tell me what is the code in visual basic to create a user name and a password? thanks

 Tags:

   Report

3 ANSWERS


  1. u wanna create it as program ?

    if u do u can use if statement

    that's the easiest way to solve ur prob

    but it won't be very secure


  2. Follow this URL. You may find the answer here

    http://visualbasic.freetutes.com


  3. In VB6:

    PasswordChar Property Example

    This example illustrates how the PasswordChar property affects the way a TextBox control displays text. To try this example, paste the code into the Declarations section of a form that contains two TextBoxes, a Label and a Button and then press F5 and click the form. Each time you click the form, the text toggles between an asterisk (*) password character and plain text. Type MyName in the top textbox and then

    in the bottom textbox type in: 123HeLLo99 and press the button.

    Example Code:

    Dim XPAss As Integer

    Private Sub Command1_Click()

    If Text1.Text = "123HeLLo99" And Text2.Text = "MyName" Then

       Text1.Visible = False

       Text2.Visible = False

       Label1.Caption = " Access Allowed"

       Command1.Visible = False

       End If

       XPAss = XPAss + 1

       If XPAss > 2 Then

       Text1.Locked = True

       Text2.Locked = True

       Text1.Visible = False

       Text2.Visible = False

       Command1.Visible = False

       Label1.Caption = " Access Denied"

       End

       End If

    End Sub

    Private Sub Form_Click()

    Text1.Text = ""

    Text2.Text = "User name"

    Command1.Visible = True

    Text1.Visible = True

    Text2.Visible = True

    If Text1.PasswordChar = "" Then

    Text1.PasswordChar = "*"

    Else

    Text1.PasswordChar = ""

    End If

    End Sub

    Private Sub Form_Load()

    XPAss = 0

    End Sub

    If the User name (MyName) or the password (123HeLLo99) are incorrect after 3 tries then access is denied and the program terminates with End statement.

    Creating a Password Text Box

    A password box is a text box that allows a user to type in his or her password while displaying placeholder characters, such as asterisks. Visual Basic provides two text box properties, PasswordChar and MaxLength, which make it easy to create a password text box.

    PasswordChar specifies the character displayed in the text box. For example, if you want asterisks displayed in the password box, you specify * for the PasswordChar property in the Properties window. Regardless of what character a user types in the text box, an asterisk is displayed. With MaxLength, you determine how many characters can be typed in the text box. After MaxLength is exceeded, the system emits a beep and the text box does not accept any further characters.

    : )

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.