Dynamically add a VB reference dll

Posted on 2005-05-11
Medium Priority
Last Modified: 2010-04-23
see : http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20330628.html

I am having the same question -- back to:

Text1 = testblah.rettxt(blah, Val(Text2.Text))

call text1

Gives me:
Object doesnt support this propery of method.

I have testblah from creating the object and then I will have rettxt as a string because I will be calling different codes. I didn't understand what you did after this point to make it work. Any help would be greatly appreciated!! I am calling dll's I created in MatLab.

Question by:pamwestphal
  • 2
LVL 38

Expert Comment

ID: 13982883
VB6 or VB.NET?
You posted this question in the VB.NET area.
The other question is posted in the VB6 area.  It makes a bit of a difference to how you would load a library dynamically.

Author Comment

ID: 14053740
You are right, but I am working in VB.net
LVL 38

Accepted Solution

PaulHews earned 1600 total points
ID: 14055906
Here is an example that creates a COM object in VB.NET and sets a string property.  You can call methods or return properties using other values for the BindingFlags enumeration of InvokeMember... Note that you can use different approaches depending whether you are willing to turn option strict off.

Dim MyType As Type
Dim MyObject As Object

MyType = Type.GetTypeFromProgID("ProjectID.ClassName")
'Create instance of MyObject
MyObject = Activator.CreateInstance(MyType)

'Set a string property  - option strict on
Dim parameter() As Object = {"Hello"}
MyType.InvokeMember("MyProperty", Reflection.BindingFlags.SetProperty, Nothing, MyObject, parameter)

'Set a string property - option strict off
MyObject.MyProperty = "Hello"


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question