How to Create instance of a class defined in .Net Class Library without setting reference


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to Create instance of a class defined in .Net Class Library without setting reference

  1. #1
    Jaideep Guest

    How to Create instance of a class defined in .Net Class Library without setting reference


    Hi All,

    I have one Windows Application project, 3 Class Library projects. All
    implemented in VB.net. The three Class Library projects are briefed as below
    1. The first Class Library defines one or more Abstract Classes
    2. The other two Class Libraries defines classes which inherit from the abstract
    classes defined in the first class library.

    The Windows Application project should refer only to the first Class Library
    project's assembly. Based on certain parameter settings in the Windows Applications'
    .ini file I should be able to create instances of the classes either defined
    in second or third class library. The Windows application cannot refer to
    the second or third libraries.

    In brief, I would like to create an instance of a class which is defined
    in a library but has no reference set in the project. In VB6, I know we can
    implement using the CreateObject function and passing the ProgId. As that
    was a COM technology, the CreateObject function was obtaining the information
    frlom the Registry and creating & returning an instance of the required class.


    I Tried, Searched all the documentation accessible to me on how to do the
    same in VB.Net, but in vain. I appreciate if anyone can give some directions
    to the solution on how to implement this. Hope my question is clear, If not
    please donot hesitate to email me at jaideepvr@netpundits.com

    Thanks in Advance
    - Jaideep

  2. #2
    Patrick Steele [MVP] Guest

    Re: How to Create instance of a class defined in .Net Class Library without setting reference

    In article <3d76d779$1@10.1.10.29> (from Jaideep
    <jaideepvr@netpundits.com>),
    >
    > Hi All,
    >
    > I have one Windows Application project, 3 Class Library projects. All
    > implemented in VB.net. The three Class Library projects are briefed as below
    > 1. The first Class Library defines one or more Abstract Classes
    > 2. The other two Class Libraries defines classes which inherit from the abstract
    > classes defined in the first class library.
    >
    > The Windows Application project should refer only to the first Class Library
    > project's assembly. Based on certain parameter settings in the Windows Applications'
    > ini file I should be able to create instances of the classes either defined
    > in second or third class library. The Windows application cannot refer to
    > the second or third libraries.
    >
    > In brief, I would like to create an instance of a class which is defined
    > in a library but has no reference set in the project. In VB6, I know we can
    > implement using the CreateObject function and passing the ProgId. As that
    > was a COM technology, the CreateObject function was obtaining the information
    > frlom the Registry and creating & returning an instance of the required class.


    See this example. It should get you going:

    http://groups.google.com/groups?selm...8ad2ab0989cad%
    40msnews.microsoft.com&oe=UTF-8

    --
    Patrick Steele
    Microsoft .NET MVP
    http://radio.weblogs.com/0110109

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center