LoginForm that accepts multiple users and passwords

Posted on 2009-12-16
Medium Priority
Last Modified: 2012-05-08
I made a login form using the code from a related solution "how to make a login form for an application".

My next question is how to set up the text files to hold the actual user names and passwords that I will add to allow the users access to my application.

Question by:Danean
  • 2

Accepted Solution

Trideep Patel earned 2000 total points
ID: 26069062
You can save that information either in database or in XML file
if you are having user creation module in your application then you can fill dataset from XML file
add new users to that dataset then
Finally save the dataset as xml like


Author Comment

ID: 26072005
I am using a LoginForm and I can hardcode in each user with what I have below.  I am not sure how to code it to compare what the user input to see if it is in the file.

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If UsernameTextBox.Text = "user" And PasswordTextBox.Text = "password" Or UsernameTextBox.Text = "user" And PasswordTextBox.Text = "password" Then
        End If

    End Sub

Author Comment

ID: 26075559
I came up with an answer which works great.  Thanks for your help.

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        Dim cn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=(path\file.mdb;" + "User id=admin;" + "Password=")
        Dim cmd As OleDbCommand = New OleDbCommand("select count(*) from User1 where username='" + Me.UsernameTextBox.Text + "'and password='" + Me.PasswordTextBox.Text + "'", cn)
        Dim count As Integer = Convert.ToInt32(cmd.ExecuteScalar())
        If (count > 0) Then
            MsgBox("Login Failed")
        End If
    End Sub


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

850 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