473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Creating COM Objects in VB.NET


I need to write some VB.NET objects that can be called from another
environment (a Progress app, specifically). I'm having some
difficulty getting this to work.

My first assumption was that I should write a COM object. Is this a
good approach? Or is there a better one?

I wrote the new VB.NET object and included a COM Class object. All is
fine and the system creates a TLB file and everything. It all works
great on my development machine. But when I try to deploy it to the
target (XP-PRO) machine and write a test subroutine in Word using VBA
to access the object, I fail. It works in VBA on my development
machine, but not on the machine I'm deploying to.

First, I can't see my COM object when I try to add a reference in VBA.
So I use regasm.exe to register the COM object DLL - it reports
success. But my COM object still doesn't show up in Word VBA's list
of COM objects that I can reference. But when I do a "browse", I can
see it, and the TLB file. I can't reference the DLL, but I *can*
reference the TLB.

And then VBA knows about my COM object and I can add it to my VBA code
(intellisense works and everything). But then when I run the VBA
subroutine, when it tries to run a function from my VBA object I get
an error saying "File or assembly name MKRCOM, or one of its
dependencies, was not found."
Does anybody know what I need to do? Or can anyone point me to a
resource that describes how to develop COM objects under VB.NET that
can be called by non -.NET programs?
Thanks in advance...
Nov 21 '05 #1
8 4448
On Fri, 28 Oct 2005 14:06:00 -0500, Wilbur Slice wrote:
Does anybody know what I need to do? Or can anyone point me to a
resource that describes how to develop COM objects under VB.NET that
can be called by non -.NET programs?


Just a guess, but have you ruled out .NET permission issues?

I haven't done what you're doing specifically, but I do have a situation
where my .NET program invokes a COM object and passes it .NET objects,
which then the COM object calls methods on. This works fine.
Specifically, the COM object is the Microsoft Script Control, and the .NET
object is a specialized collection class.
Nov 21 '05 #2
On Fri, 28 Oct 2005 15:25:32 -0400, Ross Presser
<rp******@NOSPAMgmail.com.invalid> wrote:
On Fri, 28 Oct 2005 14:06:00 -0500, Wilbur Slice wrote:
Does anybody know what I need to do? Or can anyone point me to a
resource that describes how to develop COM objects under VB.NET that
can be called by non -.NET programs?
Just a guess, but have you ruled out .NET permission issues?


I don't know what you mean by that - could you elaborate?

I think it has something to do with registering the objects somehow,
because apparently Visual Studio does it for me automatically during
development - I have none of these problems on my development machine.
But on the machine I'm deploying to, which does not have Visual Studio
on it, it doesn't work.


I haven't done what you're doing specifically, but I do have a situation
where my .NET program invokes a COM object and passes it .NET objects,
which then the COM object calls methods on. This works fine.
Specifically, the COM object is the Microsoft Script Control, and the .NET
object is a specialized collection class.

Nov 21 '05 #3
Make sure you have Register fo COM Interop checked in the project properties
for the DLL before you build it.
It is in Configuration Properties->Build options
"Wilbur Slice" wrote:

I need to write some VB.NET objects that can be called from another
environment (a Progress app, specifically). I'm having some
difficulty getting this to work.

My first assumption was that I should write a COM object. Is this a
good approach? Or is there a better one?

I wrote the new VB.NET object and included a COM Class object. All is
fine and the system creates a TLB file and everything. It all works
great on my development machine. But when I try to deploy it to the
target (XP-PRO) machine and write a test subroutine in Word using VBA
to access the object, I fail. It works in VBA on my development
machine, but not on the machine I'm deploying to.

First, I can't see my COM object when I try to add a reference in VBA.
So I use regasm.exe to register the COM object DLL - it reports
success. But my COM object still doesn't show up in Word VBA's list
of COM objects that I can reference. But when I do a "browse", I can
see it, and the TLB file. I can't reference the DLL, but I *can*
reference the TLB.

And then VBA knows about my COM object and I can add it to my VBA code
(intellisense works and everything). But then when I run the VBA
subroutine, when it tries to run a function from my VBA object I get
an error saying "File or assembly name MKRCOM, or one of its
dependencies, was not found."
Does anybody know what I need to do? Or can anyone point me to a
resource that describes how to develop COM objects under VB.NET that
can be called by non -.NET programs?
Thanks in advance...

Nov 21 '05 #4
On Fri, 28 Oct 2005 16:45:01 -0700, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
Make sure you have Register fo COM Interop checked in the project properties
for the DLL before you build it.
It is in Configuration Properties->Build options


I did. Didn't make any difference.

But here's what I found: I figured that if Visual Studio was doing
all the necessary things (my objects work fine on the development
machine), then maybe I should create a Deployment project for my COM
objects and install them on the target machine that way, instead of
just trying to take the DLL and TLB files over and manually installing
them.

And sure enough, that worked. Whatever it is that Visual Studio is
doing, the deployment install procedure is doing as well, and my
objects now work on the target machine. I still don't know what
exactly it was that was missing or was being done wrong, but this way
works, so I think I'm good to go now.
Nov 21 '05 #5
You can also use Regasm to register the dll pn the target machine.

"Wilbur Slice" wrote:
On Fri, 28 Oct 2005 16:45:01 -0700, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
Make sure you have Register fo COM Interop checked in the project properties
for the DLL before you build it.
It is in Configuration Properties->Build options


I did. Didn't make any difference.

But here's what I found: I figured that if Visual Studio was doing
all the necessary things (my objects work fine on the development
machine), then maybe I should create a Deployment project for my COM
objects and install them on the target machine that way, instead of
just trying to take the DLL and TLB files over and manually installing
them.

And sure enough, that worked. Whatever it is that Visual Studio is
doing, the deployment install procedure is doing as well, and my
objects now work on the target machine. I still don't know what
exactly it was that was missing or was being done wrong, but this way
works, so I think I'm good to go now.

Nov 21 '05 #6
On Mon, 31 Oct 2005 11:57:17 -0800, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
You can also use Regasm to register the dll pn the target machine.
No, as I said earlier, I tried that and it didn't work.

"Wilbur Slice" wrote:
On Fri, 28 Oct 2005 16:45:01 -0700, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
>Make sure you have Register fo COM Interop checked in the project properties
>for the DLL before you build it.
>
>
>It is in Configuration Properties->Build options


I did. Didn't make any difference.

But here's what I found: I figured that if Visual Studio was doing
all the necessary things (my objects work fine on the development
machine), then maybe I should create a Deployment project for my COM
objects and install them on the target machine that way, instead of
just trying to take the DLL and TLB files over and manually installing
them.

And sure enough, that worked. Whatever it is that Visual Studio is
doing, the deployment install procedure is doing as well, and my
objects now work on the target machine. I still don't know what
exactly it was that was missing or was being done wrong, but this way
works, so I think I'm good to go now.

Nov 21 '05 #7
I am having the exact same problem! However, it is happening to me on the
development system too, but I am using Visual Basic Express Edition. What is
even stranger is that the exact same assembly taken to a machine that has the
full version of Visual Studio on it will work. Also strange is that on the
machine with only Visual Basic Express I can access the object perfectly from
VB6, but not from VBA in Office XP or Office 2003.

While the deployment workaround may help (I will try it), I am still very
uncomfortable not knowing what the problem is. I am going to make a separate
post for this issue too.
"Wilbur Slice" wrote:
On Fri, 28 Oct 2005 16:45:01 -0700, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
Make sure you have Register fo COM Interop checked in the project properties
for the DLL before you build it.
It is in Configuration Properties->Build options


I did. Didn't make any difference.

But here's what I found: I figured that if Visual Studio was doing
all the necessary things (my objects work fine on the development
machine), then maybe I should create a Deployment project for my COM
objects and install them on the target machine that way, instead of
just trying to take the DLL and TLB files over and manually installing
them.

And sure enough, that worked. Whatever it is that Visual Studio is
doing, the deployment install procedure is doing as well, and my
objects now work on the target machine. I still don't know what
exactly it was that was missing or was being done wrong, but this way
works, so I think I'm good to go now.

Dec 15 '05 #8
I was able to find the explanation and solution in another post:

This looked like a bug on Microsoft's part. I found a work around by
first creating a Excel.exe.config file with these entries:

<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v2.0.50110" />
<supportedRuntime version="v1.1.4322" />
<supportedRuntime version="v1.0.3705" />
<requiredRuntime version="v1.0.3705" />
</startup>
</configuration>

Then, when I searched further on the net, found this update fix from
Microsoft which fixed the problem even without the config file above:
http://www.microsoft.com/downloads/d...displaylang=en

hope this helps.
thanks

"DanP" wrote:
I am having the exact same problem! However, it is happening to me on the
development system too, but I am using Visual Basic Express Edition. What is
even stranger is that the exact same assembly taken to a machine that has the
full version of Visual Studio on it will work. Also strange is that on the
machine with only Visual Basic Express I can access the object perfectly from
VB6, but not from VBA in Office XP or Office 2003.

While the deployment workaround may help (I will try it), I am still very
uncomfortable not knowing what the problem is. I am going to make a separate
post for this issue too.
"Wilbur Slice" wrote:
On Fri, 28 Oct 2005 16:45:01 -0700, "TrtnJohn"
<Tr******@discussions.microsoft.com> wrote:
Make sure you have Register fo COM Interop checked in the project properties
for the DLL before you build it.
It is in Configuration Properties->Build options


I did. Didn't make any difference.

But here's what I found: I figured that if Visual Studio was doing
all the necessary things (my objects work fine on the development
machine), then maybe I should create a Deployment project for my COM
objects and install them on the target machine that way, instead of
just trying to take the DLL and TLB files over and manually installing
them.

And sure enough, that worked. Whatever it is that Visual Studio is
doing, the deployment install procedure is doing as well, and my
objects now work on the target machine. I still don't know what
exactly it was that was missing or was being done wrong, but this way
works, so I think I'm good to go now.

Dec 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: vande | last post by:
Hi, I am trying to create com objects in asp.net. The objects are getting created but the context in the object created is null. If I create the same object in asp the object is ok and the...
8
by: Nanda | last post by:
hi, I am trying to generate parameters for the updatecommand at runtime. this.oleDbDeleteCommand1.CommandText=cmdtext; this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
2
by: JJ L. | last post by:
Hello. I have a project that consists of nine different objects, each serving their own purpose. In the past I have just created a form for each one, and then whenever you call, say,...
5
by: Chris | last post by:
Hi, to create an array of 2 objects (e.g. of type '__gc class Airplane') I need to do : Airplane * arrAirplanes __gc = new Airplane* __gc; arrAirplanes = new Airplane("N12344"); arrAirplanes...
3
by: Ken Varn | last post by:
I am just starting the process of creating ASP.NET server controls. I have created controls for .NET applications, but have just started with ASP.NET. I am a little confused about some areas that...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
1
by: chris | last post by:
I know I've asked this before, but I didn't really get an answer and I bet it's because I didn't explain myself very well. Here goes again. I have this code: Dim arrData(intNoOfRows,...
5
by: fireball | last post by:
please help newbie I need to create a lot of objects the same type (let's say: schemas) I wish to use paramerized block in loop to do so. - how to put names of my objects to such control-flow? ...
31
by: JoeC | last post by:
I have read books and have ideas on how to create objects. I often create my own projects and programs. They end up getting pretty complex and long. I often use objects in my programs they are...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.