Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 8th, 2005, 09:18 AM
dt_aiying dt_aiying is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 93 dt_aiying User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 13 h 58 m 8 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old November 10th, 2005, 11:00 AM
Alias-Zero Alias-Zero is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: localhost
Posts: 40 Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 14 h 44 m 12 sec
Reputation Power: 4
Send a message via ICQ to Alias-Zero Send a message via AIM to Alias-Zero Send a message via MSN to Alias-Zero Send a message via Yahoo to Alias-Zero
Quote:
Originally Posted by dt_aiying
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



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

Reply With Quote
  #3  
Old November 16th, 2005, 11:52 PM
dt_aiying dt_aiying is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 93 dt_aiying User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 13 h 58 m 8 sec
Reputation Power: 4
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

Reply With Quote
  #4  
Old November 18th, 2005, 09:20 PM
Alias-Zero Alias-Zero is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: localhost
Posts: 40 Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level)Alias-Zero User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 14 h 44 m 12 sec
Reputation Power: 4
Send a message via ICQ to Alias-Zero Send a message via AIM to Alias-Zero Send a message via MSN to Alias-Zero Send a message via Yahoo to Alias-Zero
No problem, my pleasure.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Storing data consistantly between forms


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT