Results 1 to 4 of 4

Thread: keeping variables while changing forms [resolved]

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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:
    1. Private Sub cmd_login_Click()
    2.   Dim check As String, loggedin As Boolean
    3.   inUser = txt_user.Text
    4.   inPass = txt_pass.Text
    5.   'username is case insensitive, convert it to lower case
    6.     inUser = LCase(inUser)
    7.   'get rid of unwanted characters in username and password
    8.     inUser = safeStr(inUser)
    9.     inPass = safeStr(inPass)
    10.   'open user file and check validility of password
    11.   check = OpenFile(pathUsers & inUser & pathType)
    12.   If check = inPass Then
    13.     loggedin = True
    14.   Else
    15.     loggedin = False
    16.   End If
    17.   If loggedin = True Then
    18.     'get rid of login screen
    19.       Form1.Visible = False
    20.     'show logged in screen
    21.       Form2.Visible = True
    22.   End If
    23. 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.
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width