Hi guys.

First time im using this site and i really hope you guys can help me...OK here goes. I need help on a multiform program I am working on, the program is quite simple but i need some help from you guys concerning the login form. Ok, i need a login form with 3 user accounts and when each person enters thier username and password it should "call" or "display" the desired form. im not too sure on how to do this because my textbook does not cover this topic. so please can you guys help me out?\

Thanks alot in advance, i am patiently waiting on your replies.

not really understandable to be honest.
are the 3 users have to enter their login on the same application running on the same PC to the same time? or they are on different machines?
is it working with a databse?

I think you will just configure the security folder of the Database to set the desired user..

yes all the users are to login on the same pc, the same application. its not really a complicated program but i am new vb so its difficult for me.

You can create a log in program by using a database or using coding.
Add an extra form to project.
You can compare user typed text using the If Else statement.
If the name is "A" and Password is "123" then in the Login button control use a comparison statement like

If Textbox1.Text="A" then
        If Textbox2.Text="123" then
            Me.Hide()
            Form2.Show()
        Else
        Msgbox " Please Check your password ... "
        End If
Else
        Msgbox " Please Check your Username ...."
End If

Or
If you are using a database then connect to the user database and then load the values to 2 hidden text boxes and compare it like

If Textbox1.Text=UserText.Text then
        If Textbox2.Text= PWDText.Text then
            Me.Hide()
            Form2.Show()
        Else
        Msgbox " Please Check your password ... "
        End If
Else
        Msgbox " Please Check your Username ...."
End If

Don't forget to change the Text property to make it look like a password.

Try it ....
Best of luck ....

Hi Vineeth K thanx very much for your post, it was very helpfull but I dont really understand your second example because I am not really familiar with the databse concept but ill give my understanding of it anyway. . .Would a txt file be sufficent to save all the users names and passwords so that they be can compared with the users input from the loginForm texboxes using an IF ELSE statment as you have done above?

I just tried your 1st method in my program now Vineeth k and when I ran it, it did not even dislplay the login form it just displayed the form that I want in to show AFTER the username and password is typed in.

Heres the code:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        With Me
            If .UsernameTextBox.Text = "John" Then
                If .PasswordTextBox.Text = "1234" Then
                    Me.Hide()
                    First_logbook.Show()
                Else
                    MessageBox.Show(" Please Check your password ")
                End If
            Else
                MessageBox.Show(" Please Check your username ")
            End If
        End With

    End Sub

Hey i think it is not necessary to use Me.UsernameTextBox.Text.
Just type UsernameTextBox.Text if it is in that form.
Please give a Break point in all major codes and then run.
Please check other part of codes...

This article has been dead for over six months. Start a new discussion instead.