Login program VB 6.0

multiple user login with select case

Page 1 of 1

4 Replies - 5534 Views - Last Post: 28 July 2010 - 07:16 AM Rate Topic: -----

#1 meggyland  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-July 10

Login program VB 6.0

Posted 27 July 2010 - 01:13 PM

hi!

I am trying to create a login application with 5 users however i tried SELECT CASE and and if.then but it doesnt work out...
do you think if is there any problem with naming my variables??

i have 3 users, "C" and F is another and the password for now its "pass1", "pass2" etc...

here its my code


User = Textuser.Text
Select Case User

Case "C"
Textuser.Text = "C"
Text2.Text = "pass1"
Case "A"
Textuser.Text = "A"
Text2.Text = "pass2"
Case "F"
Textuser.Text = "F"
Text2.Text = "pass3"
Case Else
MsgBox "password/user invalido", vbCritical, "Error"
End Select

End Sub

thanks so much...
hope this site works. :D

Is This A Good Question/Topic? 0
  • +

Replies To: Login program VB 6.0

#2 meggyland  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-July 10

Re: Login program VB 6.0

Posted 27 July 2010 - 01:25 PM

User = Textuser.Text
    Select Case User

        Case "C"
        Textuser.Text = "C"
        Text2.Text = "pass1"
        Case "A"
        Textuser.Text = "A"
        Text2.Text = "pass2"
        Case "F"
        Textuser.Text = "F"
        Text2.Text = "pass3"
        Case Else
        MsgBox "password/user invalido", vbCritical, "Error"
        End Select

End Sub


another solution is
Dim user As String
Dim user2 As String
Dim pass As String
Dim pass2 As String
Public Sub trylogin()

If text1.Text = user And text2.Text = pass Then
MsgBox "login successfully", vbInformation, "welcome"
If text1.Text = user2 And text2.Text = pass2 Then
MsgBox "login successfully", vbInformation, "welcome"
Else
MsgBox "wrong password/user", vbCritical, "error"
End If
End If
End Sub



Edited by macosxnerd101: Welcome to DIC! :) Please remember to post your code using code tags, like so: :code:.
Was This Post Helpful? 0
  • +
  • -

#3 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 465
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Login program VB 6.0

Posted 27 July 2010 - 01:27 PM

What are you trying to do? Because what you do now is to just select the user and set the text box for user name and password with some text. where are you trying to log in ?
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10695
  • View blog
  • Posts: 39,790
  • Joined: 27-December 08

Re: Login program VB 6.0

Posted 27 July 2010 - 08:07 PM

What is wrong with your code? Do you have a question?
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10695
  • View blog
  • Posts: 39,790
  • Joined: 27-December 08

Re: Login program VB 6.0

Posted 28 July 2010 - 07:16 AM

Duplicate topics merged. Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1