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:
I think many people will appreciate your effort JuggaloBrotha. However, if your intention is to: minimize those "login form not working right" threads, I think we have to think a way for this thread to get sticky. Otherwise, when people can't find this thread on their first screen, they will ask the same question again... :)
 
Hi all!

I would like to write a similiar example, but I need to have same Control ID of both TextBoxes (username and password) every time I start the application...

When I write this application in VisualBasic, everything is ok, the Control ID of each control is same every time a start the application, but in VB.NET not...

I am checking ControlID of these controls by WinSpy++ (http://www.catch22.net/software/winspy.asp). I need the same values because of PasswordBank utility (it should fill up the password automaticaly, but it is identifiyng controls by Control ID, which is in VB.NET every time different).

Thanks a lot for advice!
 
the only ControlID that i can think of is the control's name, which only changes if you change it in the designer or in code
 
You wouldn't happen to have this in the form of an access database would you?

I made it so you would be the one to implement where the login data is comming from, all I've provided here is the user's interface for typing in the login data.

So what you would need to do is, after getting what the user typed in, check it against whatever data source you need to check it against.

I've used this with an Access database, sql server database, and oddly enough, an excel file
 
Hello. Is there anyway I could grab the username information and grab the password information from 2 different text documents (.txt) from my computer or online storage?
 
Back
Top