By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

DLL During run time

P: 56
Guys i need guidance,

I have an xml converter which uses dll to be referenced upon. For testing purposes.
Now, my question is, can i reference a dll file on vb 6.0 during runtime? So that when we try to convert to xml we don't have to stop the program -> recode -> ->start.

Thanks in advance.
May 7 '08 #1
Share this Question
Share on Google+
19 Replies


P: 56
Set dllname = New SkillsManager

SkillsManager is the name of the DLL file.

How can i make a statement like this during runtime? I mean, how can i execute a statement like this where let's say i'd like to replace skillsmanager with another dll without having to recode again in design view. Given that all the DLLs are referenced.

Thanks.
May 7 '08 #2

P: 56
UPDATE:

I search and tried to apply this:

a = "Set dllname = New SkillsManager"
Call ScriptControl1.ExecuteStatement(a)

But i'm getting an error saying, "Class not defined: SkillsManager"

Anybody who could help?
i would greatly appreciate it.
May 7 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

You can use Late Binding of the objects:

Expand|Select|Wrap|Line Numbers
  1. Dim MyObj as Object
  2. Set MyObj = CreateObject(“MyDLL.MyClass”)
  3. MyObj.Myprop = “XYZ Name”
  4. MyObj.MyMethod
  5.  
with above code, You can change MyDll.MyClass, to the Class in dll.
the problem here is, You wont get Intellisense.
More over, you need to check properties and Methods.
If any method/property is not supported by the new dll's class, or you may end up in run time error..

Such a method is used in same Dll's with different version (say Word/Excel).

Regards
Veena
May 7 '08 #4

P: 56
Uhm, to clear things up here is the scenario.

I have 100+ DLL files that i need to test.
I need to figure out a way on how to save

"Set dllname = New HRMSSkills.SkillsManager" <- this statement as a string and execute it during runtime. by saying so i can change "HRMSSkills.SkillsManager" unto anything i want meaning i can manipulate the string and change the DLL file that i want to test. Again, during runtime so that i don't need to recode everytime, 100+ times in particular.

Haha, it's very frustrating.

Here's a piece of what i have so far:

Dim dllname As HRMSSkills.SkillsManager

a = "Set dllname = New HRMSSkills.SkillsManager"
Call ScriptControl1.ExecuteStatement(a)

When the Call line is being executed i get the error: "Class not defined: HRMSSkills"

Am i missing something? Do i need to step back and think it over again?
May 7 '08 #5

P: 56
Cool, it works now. Thanks.

but i do have another question. How do i get the possible Intellisense and put it unto a variable? An array in particular. That would be my last question.

I.E

HRMSSkills.SkillsManager

SkillsManager can laso be SkillsProvider, etc.

Is there a possiblity that i can get the value of those?
May 7 '08 #6

QVeen72
Expert 100+
P: 1,445
Hi,

To get the List of all the members/methods of the DLL.
You can Include the Dll in a New project. and Check the "Object Browser".
Select the dll on the top and Class name from the Left List..
Members and methods for that Class are popluated in the Right List..
This is one easy way out..

Regards
Veena
May 7 '08 #7

P: 56
Thanks, i'll try that later. I need to sleep. XD thanks for the reply. I'll post if something goes wrong.
May 7 '08 #8

P: 56
Uhm, how do i do this exactly? Sorry, i'm new at this.
May 8 '08 #9

P: 56
Ok i think i got it. But what i need is that i want to see those methods during run time. Anybody who can help me?
May 8 '08 #10

P: 56
I am getting an error "ActiveX cannot create object" on this line of code

Set dllname = CreateObject(Combo1.Text)

A little help please? I've been stuck with this for days. Thanks.
May 14 '08 #11

QVeen72
Expert 100+
P: 1,445
Hi,

You need to use this code:

Expand|Select|Wrap|Line Numbers
  1. Dim MyObj As Object
  2. Set MyObj = CreateObject("Access.Application")
  3.  
If you are using a ComboBox, to populate the dll names, then
CreateObject takes "DLLName.ClassName" as argument.
You may get error if you are creating only DLLName as object..

Regards
Veena
May 14 '08 #12

P: 56
Thanks! but now i'm getting a new error that says, "File name or classname not found during Automation operation." on this line of code

Output = dllname.GetRecord(InputTextbox.Text)

Where getrecord is a method of HRMSSkills.SkillsManager

Thanks for the reply. You guys are helping me a lot.
May 14 '08 #13

QVeen72
Expert 100+
P: 1,445
Hi,

Check how many Arguments does the GetRecord take..
Also post the modified code here...

Regards
Veena
May 14 '08 #14

P: 56
Dim dllname As Object

Set dllname = CreateObject(Combo1.Text)

Output = dllname.GetRecord(InputTextbox.Text)

What happens is that when i try to run the program the "GetRecord" class which is located within the DLL isn't recognized or found.


Arguments? I'm not sure about what you mean.
thanks for the quick replies.
May 14 '08 #15

QVeen72
Expert 100+
P: 1,445
Hi,

What values are there in Combo1.Text and TextBox...?
I Guess, "GetRecords" must be some Procedure/Function..
Arguments means, Any procedure /function which takes some values...

Regards
Veena
May 14 '08 #16

P: 56
Here's the combo1.text of course depending on what you choose but here's a sample.

HRMSSkills.SkillsManager

And for the input text:

<?xml version="1.0" encoding="iso-8859-1" ?>
<Requests>
<Request>
<RequestType>Include</RequestType>
<IncludeString>
<row strEmpNo="1234567" strUserID="1234567" strSessionID="1052866004" strDimension1="" strDimension2="" strJobPosition="" strHomeURL="http://HURISBDC02/HRMS/" strDateFormat="dd mmm yyyy" strNameSpace="D:/Applications/WebRoot/HRMSNS/" blnHdrVisible="True" blnNavVisible="True" />
</IncludeString>
</Request>
<Request>
<RequestType>Skills Classifier</RequestType>
<RequestParameters>
<EmpNo>1234567</EmpNo>
<Dimension1>FGP</Dimension1>
<Dimension2 />
<JobPosition />
</RequestParameters>
</Request>
</Requests>
May 15 '08 #17

QVeen72
Expert 100+
P: 1,445
Hi,

InputTextBox has all that...?
It looks like an XML Page..
May be the error is because of that..
You need to pass arguments/call functions as you normally do when calling a procedure..

Regards
Veena
May 15 '08 #18

P: 56
Here's the scenario, I have a DLL file now i use it as reference to convert parameters to XML. Now i did some experiments and added the class/modules of that DLL (HRMSSkills.DLL) unto my program It works but when i only use it as reference it throws back an error "File name or Class name not found during Automation operation".

I've been stuck on this task for days now. I need help. Thanks in advance.
May 15 '08 #19

P: 56
Our senior programmer fixed the problem. Thanks for all the replies.
May 15 '08 #20

Post your reply

Sign in to post your reply or Sign up for a free account.