|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Storing data consistantly between forms
Hi everyone,
I have such a scenario in my VB system development. I'm confident that many of you experts know how to get this done. Please help. Appreciate any suggestions. Many thanks in advance. A user logs into the system through the login form. In a subsequent form, the program should display the user's login name which was first inputted in the login form (upon successful login). How do I display the user's login name in a subsequent form? In a subsequent form, I have tried the following codes (a, b and c) but during program execution, the user's login name is not displayed (blank) in the a subsequent form. To my observation, only after a subsequent form has been closed and re-opened (user still has not logged out), then only the user's login name is displayed in that subsequent form. How do I fix this problem? What are the methods / options available? a) lblUserName.Caption = frmLogin.txtUserID.Text b) Dim strUN As String strUN = frmLogin.txtUserID.Text lblUserName.Caption = strUN c) 'Start - Code in module Public g_strUserID As String 'End 'Start - Code in login form 'upon successful login g_strUserID = txtUserID.Text 'End 'Start - Code in subsequent form lblUserName.Caption = g_strUserID 'End |
|
#2
|
|||
|
|||
|
Quote:
Try this: Form1 (Contains a textbox, txtUserName)(Command Button) Form2 (Contains a textbox, txtGreet) This works fine for me: Code:
Private Sub Command1_Click() Dim fShow As New Form2 fShow.txtGreet.Text = Form1.txtUserName.Text fShow.Visible = True Me.Hide End Sub |
|
#3
|
|||
|
|||
|
Thanks. Your post helped me with this problem.
I wrote this in the VB login form (upon successful login) and it managed to solve the problem. frmSubsequent.lblUserName.Caption = txtUserID.Text |
|
#4
|
|||
|
|||
|
No problem, my pleasure.
![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Storing data consistantly between forms |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|