473,666 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4462
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******@NOSPA Mgmail.com.inva lid> 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******@discu ssions.microsof t.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******@discu ssions.microsof t.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******@discu ssions.microsof t.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******@discu ssions.microsof t.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******@discu ssions.microsof t.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.confi g file with these entries:

<?xml version="1.0" encoding="Windo ws-1252"?>
<configuratio n>
<startup>
<supportedRunti me version="v2.0.5 0727" />
<supportedRunti me version="v2.0.5 0110" />
<supportedRunti me version="v1.1.4 322" />
<supportedRunti me version="v1.0.3 705" />
<requiredRuntim e version="v1.0.3 705" />
</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******@discu ssions.microsof t.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
1204
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 context variable is not null. The context is used in com objects to manage the transactions and other activities. Any help in creating the com objects in asp.net without the context variable is appreciated. I am using Server.Createobject function to...
8
5961
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; this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ApplicantName", dataset.Tables.Columns.DataType, 50,
2
1531
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, object.Display(), it would call up the form associated with that object. This form only displays information, it doesn't allow the user to edit any information. Is it possible to find the properties of a certain object, and then loop through creating labels...
5
1940
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 = new Airplane("N12345"); Actually, I create an array of Airplane-pointers first and then create the
3
1857
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 I am hoping someone can help clear up. 1. What is the difference between initializing a control in the constructor, vs the OnInit(), vs the CreateChildControls() methods? 2. The control that I created contains an Items collection attribute...
5
2274
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 collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to populate the properties of those Person objects from a datasource: instantiate one Person, fill...
1
1352
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, intNoOfColumns) As Object Dim intR As Integer For intC As Integer = 0 To intNoOfColumns - 1
5
1541
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? belss you for help
31
3181
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 some of the most powerful programming tools I have found. Often times as my program grows so do my objects. Often times I look back and see that my objects could be broken down int several smaller more re-usable module pieces of code. Is it a...
13
12788
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 scripting language that makes writing automated tests simpler. Really, I'm looking to kind of abstract the power of the C# language into a simpler language that's easier to learn. The script files would be interpreted by a script interpreter...
0
8443
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.