Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello All,

In Login Form, I am saving username from usernametextbox.text to username variable.
I want this username variable to be accessible on any forms in the complete application.

For example, If i want to show the login user details on a form where I want to default that user1 has saved the data into the form, How do I do that?
Posted

1 solution

Dear friend U can save the user information in any static/shared variable for this purpose like this

Public NotInheritable Class class1
Private Sub New()
End Sub
Public Shared username As String
End Class
 
Share this answer
 
Comments
Vamshi Krishna Naidu 29-Oct-11 8:36am    
I did But this is not passing the value into my second form on load When I am calling Class1.Username.
Menon Santosh 30-Oct-11 3:18am    
class must be NotInheritable(VB)/static(C#) for this purpose, then only it can save value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900