VS2003 Login Form

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
out of boredom I've made a basic loginform for anyone to use here's the zip file containing the form, feel free to use & modify it freely ... you dont even need to tell me about it

here's basically how it works

you make an instance of it then you can set the properties UserId, Password, UserIdMaxLength and PasswordMaxLength then just call the the ShowDialog method

or I've provided some other ShowDialog signatures that allows those properties to be set with only 1 ShowDialog call

also when the Login button is clicked on the window you can retrieve the UserID and Password from their respective properties

also this works with the DialogResult object as well so you can easily check to see if the cancel button was clicked or not

here's a quick example on how to use the LoginForm:
VB.NET:
Dim strPassword As String
Dim strUserName As String
Dim Login As New frmLogin
With Login
	.UserIDMaxLength = 12
	.PasswordMaxLength = 12
	.UserID = "Bob"
	If .ShowDialog("Test App 1") <> DialogResult.Cancel Then
		strUserName = .UserID
		strPassword = .Password
	End If
End With

*Edit 9-21-2005* Fixed a few things, also included a Demo Project
 
Last edited:
It's possible, but not within the scope of this thread. This thread simply provides you with a form that's presented to the user for gathering a username and password, once it's obtained from the user it's up to the developer to implement the code needed for validating the user input.

In your case you'd want to read in the info from the text file, parse it to get the username(s) and password(s) then present the login form to the user and see if they match. There are hundreds of examples on the web (this forum included) about reading and parsing text files. If you need help with the text file parsing, make a new thread for that topic.
 
By the way, I thought of one small feature which can be useful if added to this example for starters, that is allowing case sensitive usernames and passwords? What do you think?
 
Well both the web browser and zip utility works on that machine, because everything else is downloading and opening properly in the zip utility. But just to test I tried it on my other machine where it worked. Both the attachments are working fine now. I don't know what's wrong on the other machine because everything else works fine on that machine, only problems with attachments on this board.

By the way, I thought of one small feature which can be useful if added to this example for starters, that is allowing case sensitive usernames and passwords? What do you think?
By default it already does that, if you wanted case in-sensitive you'd need to compare the username/password by adding either .ToLower() or .ToUpper() when comparing the text.

You could add a toggle property that would cause the return of the user input using the .ToLower or .ToUpper automatically. I left stuff like this open for others to improve if they need to, and if you do add something to it feel free to make a new post here and post a zip file of your modified form(s) for others to use.

I might make the Login form a little better using VS 2008 and it'll have more stuff in it automatically.
 
I can't seem to be able to open the file in my VS 2008? By case sensitive I meant feature to support passwords like 'PasSWoRD' which is rather mixed case, but yes its upto the users to implement if they feel the need to. :)
 
Back
Top