?
Solved

Simple Password Program

Posted on 2003-03-09
3
Medium Priority
?
164 Views
Last Modified: 2010-05-01
Hey,

Could you guys (or gals) please inform me how i can use a text box so when data is input, the actual data does not appear only astericks appear. I am trying to make a simple password program and would obvously not want the input pasword to be shown.

Thanks
0
Comment
Question by:gregman22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:EverythingVB
ID: 8098512
in the Properties for your text box, set the PasswordChar to the astrick symbol

0
 
LVL 3

Expert Comment

by:Barca
ID: 8098517
Private Sub cmdLogin_Click()
    If (txtLogin.Text) = "login" and (txtPassword.Text) = "password" Then
        Unload Me
        form1.show
    End If
End Sub

would obvously not want the input pasword to be shown.<<

type * in testbox properties Passwordchar
0
 

Accepted Solution

by:
applayer earned 300 total points
ID: 8098632
here's a procedure you could use for a simple password program:

1. start a new project, a standard .exe
2. add a textbox called text1
3. add a command button called command1
4. add a label called label1
5. paste the following code and you should be ready to go!

' begin code ----------------------------------

Option Explicit

' this code will configure your form
Private Sub Form_Load()

  Me.Width = 4000
  Me.Height = 4000
  Me.Left = Screen.Width / 2 - Me.Width / 2
  Me.Top = Screen.Height / 2 - Me.Height / 2
  Me.Caption = "Password Screen"
  Me.KeyPreview = True

  Label1.Width = 3000
  Label1.Height = 1000
  Label1.Left = 200
  Label1.Top = 200
  Label1.Caption = "Please enter your password in the field below.  Then press the 'Submit' button to begin using the system."
 
 
  Text1.Width = 3500
  Text1.Font.Size = 12
  Text1.Left = 200
  Text1.Top = Label1.Top + Label1.Height + 100
  Text1.PasswordChar = "*"
  Text1.Text = ""
  Text1.TabIndex = 0
 
  Command1.Top = Text1.Top + Text1.Height + 400
  Command1.Left = 200
  Command1.Caption = "Submit"
  Command1.Width = 3500
  Command1.TabIndex = 1

End Sub

' this code will compare what the user entered to a defined password
Private Sub Command1_click()
  Dim strPassword As String
  strPassword = "password"
  If Text1.Text = strPassword Then
    Call Success
  Else
    Call Failure
  End If
End Sub

' this is your code for when the password is correct
Private Sub Success()
  Dim varMessage As Variant
  varMessage = MsgBox("Your code for success can go here", vbInformation, "Password Screen")
End Sub

' this is your code for when the password is not correct
Private Sub Failure()
  Dim varMessage As Variant
  varMessage = MsgBox("Your code for failure can go here", vbInformation, "Password Screen")
End Sub

' end code ----------------------------------
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question