|
-
Oct 22nd, 2003, 11:52 AM
#1
keeping variables while changing forms [resolved]
Ok, well, I've got a program that allows a user to login, and if the user puts in the corresponding password, it will make the current form invisible, and make a new form visible. I want to be able to move the variable "username" and "password" from Form1 (the login screen) to Form2 (the logged in screen). Is there any way to do it?
Here's some of my code, and where I think I would have to put anything that would be going to the other form..
VB Code:
Private Sub cmd_login_Click()
Dim check As String, loggedin As Boolean
inUser = txt_user.Text
inPass = txt_pass.Text
'username is case insensitive, convert it to lower case
inUser = LCase(inUser)
'get rid of unwanted characters in username and password
inUser = safeStr(inUser)
inPass = safeStr(inPass)
'open user file and check validility of password
check = OpenFile(pathUsers & inUser & pathType)
If check = inPass Then
loggedin = True
Else
loggedin = False
End If
If loggedin = True Then
'get rid of login screen
Form1.Visible = False
'show logged in screen
Form2.Visible = True
End If
End Sub
Thanks for any help.
edit: I think this might be a really simple question to answer, but I'm not really sure.. I'm fairly new to VB, and so I don't know everything about it.
Last edited by kows; Oct 22nd, 2003 at 09:31 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|