How do you initialize a variable that is in a module?
Printable View
How do you initialize a variable that is in a module?
same way you initialize a variable anywhere.
in my module I have:
VB Code:
Public strCon As String = "Provider=MSDAORA;Password=" & LogonInfo.Mx_Password & ";User ID=" & LogonInfo.Mx_Logon & ";Data Source=dbatest" Public objCon As New OleDbConnection(strCon)
when I debug and and place the mouse curser over:
LogonInfo.Mx_Logon
LogonInfo.Mx_Password
they have the correct values that I need, but when I place the cursor over (strcon) those values are missing in the string?
My best guess is that LogonInfo.Mx_Logon and LogonInfo.Mx_Password didn't have the correct values when strCon was initialized, but they got their values later. I suggest you set strCon to whatever value it has to be after you set LogonInfo.Mx_Logon and LogonInfo.Mx_Password instead of right when you declare it.