How to Use ProgID in VB.NET

  • Thread starter Thread starter eli
  • Start date Start date
E

eli

Hi,

simply put, I have a function that accepts a ProgID. I want to call
that function providing the ProgID of a DLL project (made in VB.NET!!!
NOT COM!). Can I do this? Do the Library projects created with VB.NET
have a ProgID?

thanks in advance. Any help will be appreciated

Elias
civil engineer
 
simply put, I have a function that accepts a ProgID. I want to call
that function providing the ProgID of a DLL project (made in VB.NET!!!
NOT COM!). Can I do this?

Yes. See the Activator.CreateInstance() method.
Do the Library projects created with VB.NET
have a ProgID?

They have a fully-qualified name (namespace.object) that the runtime
uses to locate the proper assembly to load.
 
Do the Library projects created with VB.NET
They have a fully-qualified name (namespace.object) that the runtime
uses to locate the proper assembly to load.

Thank you for your answer.
The name you told me about (namespace.object):
1) where can I see it?
2) Can I use it as a ProgID?

thanks again
Elias
 
Thank you for your answer.
The name you told me about (namespace.object):
1) where can I see it?

If it's your component, the namespace is something you define with the
"Namespace" statement (but becareful and check your project properties
because VB.NET adds a "Initial namespace" and that can be confusing).

Assuming the VB.NET project properties does *not* have an initial
namespace declared, here's some examples defined in code:

Namespace MyCompany
Public Class Foo
...
End Class
End Namespace

The fully qualified name of "Foo" is "MyCompany.Foo". Another example
(showing that a namespace can contain "."):

Namespace ABC.Product.Widgets
Public Class Bar
...
End Class
End Namespace

The fully qualified name of "Bar" is "ABC.Product.Widgets.Bar".
2) Can I use it as a ProgID?

You mean to create an instance of the class by name? Yes, see
"Activator.CreateInstance".
 
Back
Top