Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass Login info captured in the Login form to the mainform 2

Status
Not open for further replies.

santosh1

Programmer
Apr 26, 2002
201
0
0
US
How can I pass Login info (userID, password, server, database) from the Login form to the mainform before Load event is fired in the main form?
The reason being that I need to capture the Login info to populate the main form. I appreciate your help. S.
 
Um... you could put a Sub in the MainForm that takes n parameters and assigns them to the MainForm's variables... then when you call the form:

Dim MainForm as New Form1()

Form1.MyLittleSub(LoginValue1,...)
Form1.Show()

HTH
Ben
 
We use environment variables. These will stay active as long as the application does.

Putting into environment variables
SetEnvironmentVariable("ConnectionString", strConnectionString)

Getting out of environment variables
System.Environment.GetEnvironmentVariable("ConnectionString")

Hope this helps

Thanks

Matt
 
mattyboy
I tried using environment variable, and I can't figure out how to set them, if you get a chance, could you tell me the method used for setting them, are they used like session variables in ASP? Thanks
 
Harris,

Actually .NET has getEnvironment to get details from the Enviornment but there is nothing to set it. So what you need to do is declare an API call for setting the environment details something like the one below


Private Declare Ansi Function SetEnvironmentVariable Lib "kernel32.dll" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Integer


and then use this to set the details to Environment and then use System.Environment.GetEnvironmentVariable to read it back. Hope this will help you.

-Kris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top