Dynamically add a VB reference dll

Posted on 2005-05-11
Last Modified: 2010-04-23
see :

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
    LVL 38

    Expert Comment

    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

    You are right, but I am working in
    LVL 38

    Accepted Solution

    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now