• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Dynamically add a VB reference dll

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.

  • 2
1 Solution
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.
pamwestphalAuthor Commented:
You are right, but I am working in VB.net
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"

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now