Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I pass variable to Initialize in dll
Message
From
11/05/2001 07:40:34
 
 
To
10/05/2001 23:28:21
General information
Forum:
Visual Basic
Category:
ActiveX controls
Miscellaneous
Thread ID:
00506105
Message ID:
00506145
Views:
12
Hi!

You cannot pass any parameters to the initilizing of the ActiveX (COM) object. You can workaround this by moving initializing code to some otehr method with parameters and call that method just after object initialization.


>I have an activex dll that manages connections to an access database. The access database is protected by Access' User/Group security feature where a user has to enter a user name and password. I have the following code in my class_initialize routine:
>
>Private Sub Class_Initialize()
>
>  Set cnResources = New ADODB.Connection
>  cnResources.ConnectionString = "DSN=CompRes;"
>
>End Sub
>
>
>However, since the database implements security restricttions, I have to change the connection string to:
>
>  cnResources.ConnectionString = "DSN=CompRes;uid=" & strUser & ";pwd=" & strPwd
>
>From my Main application, I have this:
>
>Dim objServer As clsServer
>
>Sub Form_Load()
>
>  Set objConn = New clsConn
>  Set rsGeneric = objConn.OpenRecordset("Main")
>
>...
>
>End Sub
>
>The problem is, I don't know how to pass the strUser and strPWD variables to the Class_Initialize sub.
>
>I tried putting variables in the Sub_Initialize statement like:
>
>Sub Class_Initialize(var strName as String, var strKey as String)
>
>But all I get is an error.
>
>WOuld appreciate any assistance you could offer, including alternatives. Thanks in advance.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform