Creating a Com Component in VB.net 2005
- From: joshturner1967 <joshturner1967@xxxxxxxxx>
- Date: Fri, 3 Oct 2008 08:12:31 -0700 (PDT)
Hello I was hoping you guys could help me out. I am new to .net and
specifically to VB.net. I have a simple calendar popup class library
dll that I want to Com enable. The program in essence works when I
create it as a standard windows application. So I think I am good on
the end. My trouble comes when I try and create it as a Com
Component.
I was told that I should do the following
1) Set the Assembly to Com-Visiable - Done
2) Register as a Com Interop - Done
3) Compile by importing System.Runtime.InteropServices - Done
4) Just to rule everything out I made all my individual class
attributes - Com Class True, Com-Visible True, and Serializable True
at every class level
5) I made all my individual functions and sub routines attributes
public and Com-Visible. I left the disp False
I then compiled the code and it compiled without issue.
I then did a Regasm.exe on my Vbcalendar.dll and that seemed to work
because I got back a valid registration message
So If I am doing everything right up to this point (which I am not
sure) then something must be going on after this point or I am missing
a step or an understanding of something
When I go into another 2005 .net project and want to add it as a
reference. I see it my Vbcalendar on the list of Com objects that I
can use.(It has the Vbcalendar, version number and the path to the
tlb. However when I try and add it to the list I get a message that
says
" a Reference to 'VbCalendar' could not be added. The Active X type
library 'c:\VbCal\VbCalendar\VbCalendar\bin\Debug\VbCalendar.tlb was
exported from a .net assembly and cannot be added as a reference.
Add a reference to the .net assembly instead. Can someone explain
what this means and how to do it??
I am writng this as a COM Component so that an old legacy application
that reads in registered dll's can find the the library(VbCalendar),
the classes, and the the members of those classes - Normally we used
Regserv32 to register the dll and it would show up in the legacy
system however in this case all my library shows up, my classes show
up, and my memebers show up. But when I try and close the dialog with
the information I provided it pretty much tells me that the executalbe
is not found on the machine
So given all that what do you guys think I might be doing
incorrectly? I think the failure for VS Studios to be able to add the
com component as a dll is causing the failure in the legacy system.
Is this assumption correct or could it be that because the dll itself
is registered with regasm instead of regsvr32 that might be causing
the problem. If that is the case then do I need to do something to
the com component to make it readable by the legacy system?
Sorry for all the questions but I really want to understand this and I
feel I am missing a piece because of the entire aspect of a .net
component versus the com component that is making me confussed.
Can you help?
Thanks
Josh
.
- Follow-Ups:
- Re: Creating a Com Component in VB.net 2005
- From: tomek . romanowski
- Re: Creating a Com Component in VB.net 2005
- Prev by Date: RE: When do I need to pin?
- Next by Date: Re: Creating a Com Component in VB.net 2005
- Previous by thread: how to create a Net assembly as replacement for existing COM component
- Next by thread: Re: Creating a Com Component in VB.net 2005
- Index(es):
Relevant Pages
|