473,489 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Working with a VB COM Component

This is my first time having to integrate a COM component into my
dotnet project. The COM component is from a VB developer, so I have
no control over his code.

I am having the following issues after importing the COM object into
Visual Studio (2003, not 2005).

When I create an instance of a class (Jobs jobs = new Jobs()), I get
the following error message.

COM object with CLSID {6FC1CF2C-BC59-4B78-AF18-B162F2D12CA6} is either
not valid or not registered.

Also, I expected the property I needed (Let's call this UserID) to be
a string. But its datatype is System.IntPtr. Huh? What is that?
But then when I force a string and compile just to see, I get the
following compilation error.

Property, indexer, or event 'UserId' is not supported by the language;
try directly calling accessor method
'OdysseyCO._PetroToolsJobs.set_UserId(ref string)'

Now that's interesting. So I followed the recommendation and
tried .set_UserId(ref string). .set_UserId does not show up in my
intellisense, but the code compiles!

So unless there are other things I should try (can't imagine there are
any), what should I tell the VB developer?

Mar 25 '07 #1
5 1256
"David C" <pr********@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
This is my first time having to integrate a COM component into my
dotnet project. The COM component is from a VB developer, so I have
no control over his code.

I am having the following issues after importing the COM object into
Visual Studio (2003, not 2005).

When I create an instance of a class (Jobs jobs = new Jobs()), I get
the following error message.

COM object with CLSID {6FC1CF2C-BC59-4B78-AF18-B162F2D12CA6} is either
not valid or not registered.

Also, I expected the property I needed (Let's call this UserID) to be
a string. But its datatype is System.IntPtr. Huh? What is that?
But then when I force a string and compile just to see, I get the
following compilation error.

Property, indexer, or event 'UserId' is not supported by the language;
try directly calling accessor method
'OdysseyCO._PetroToolsJobs.set_UserId(ref string)'

Now that's interesting. So I followed the recommendation and
tried .set_UserId(ref string). .set_UserId does not show up in my
intellisense, but the code compiles!

So unless there are other things I should try (can't imagine there are
any), what should I tell the VB developer?

Mar 25 '07 #2
"David C" <pr********@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
This is my first time having to integrate a COM component into my
dotnet project. The COM component is from a VB developer, so I have
no control over his code.

I am having the following issues after importing the COM object into
Visual Studio (2003, not 2005).

When I create an instance of a class (Jobs jobs = new Jobs()), I get
the following error message.

COM object with CLSID {6FC1CF2C-BC59-4B78-AF18-B162F2D12CA6} is either
not valid or not registered.

Also, I expected the property I needed (Let's call this UserID) to be
a string. But its datatype is System.IntPtr. Huh? What is that?
But then when I force a string and compile just to see, I get the
following compilation error.

Property, indexer, or event 'UserId' is not supported by the language;
try directly calling accessor method
'OdysseyCO._PetroToolsJobs.set_UserId(ref string)'

Now that's interesting. So I followed the recommendation and
tried .set_UserId(ref string). .set_UserId does not show up in my
intellisense, but the code compiles!

So unless there are other things I should try (can't imagine there are
any), what should I tell the VB developer?

How does the COM interface and coclass definition looks like when using oleview.exe on the
typelib?
Are you sure you have registered the correct dll before importing? Try to re-register the
dll using regsvr32.exe

Willy.

Mar 25 '07 #3
>
How does the COM interface and coclass definition looks like when using oleview.exe on the
typelib?
I did look at it using oleview and the class I am interested in should
have a property called UserID, but it is listed as a method. This is
what it looks like.

[id(0x6803000e), propput]
void UserId([in, out] BSTR* rhs);

I don't have the slightest idea what I am looking at. I asked the VB
developer to just make it a string property (UserID, that is), but I
don't know what oleview is telling me.
Are you sure you have registered the correct dll before importing? Try to re-register the
dll using regsvr32.exe
After I posted, I did just that and I am not getting the "COM
object ....not registered" error any more. I thought I could treat
the interlop assembly like any other .NET assemblies, but I guess
not. The memories of DLL registration hell coming back...
Mar 26 '07 #4
"David C" <pr********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>
>>
How does the COM interface and coclass definition looks like when using oleview.exe on
the
typelib?

I did look at it using oleview and the class I am interested in should
have a property called UserID, but it is listed as a method. This is
what it looks like.

[id(0x6803000e), propput]
void UserId([in, out] BSTR* rhs);

I don't have the slightest idea what I am looking at. I asked the VB
developer to just make it a string property (UserID, that is), but I
don't know what oleview is telling me.
>Are you sure you have registered the correct dll before importing? Try to re-register the
dll using regsvr32.exe

After I posted, I did just that and I am not getting the "COM
object ....not registered" error any more. I thought I could treat
the interlop assembly like any other .NET assemblies, but I guess
not. The memories of DLL registration hell coming back...
A COM dll stay's a COM dll, and must be registered, this has nothing to do with .NET. Note,
that I don't know how you were able to set a reference to a non-registered COM DLL though,
you must have done something wrong.
The UserId property is passing a BSTR (Basic String), which will be marshaled as a CLI
Object.String by the COM interop marshaler when returned from COM. That means that a
'string' is the correct type for the property in C#.
Willy.

Mar 26 '07 #5
>
A COM dll stay's a COM dll, and must be registered, this has nothing to do with .NET. Note,
that I don't know how you were able to set a reference to a non-registered COM DLL though,
you must have done something wrong.
I did Project->Add Reference. Clicked on the Com tab, clicked
"Browse" and found the COM dll and just imported it that way. From
there, I was able to use it.
The UserId property is passing a BSTR (Basic String), which will be marshaled as a CLI
Object.String by the COM interop marshaler when returned from COM. That means that a
'string' is the correct type for the property in C#.
MyClass.UserId does not compile. I cannot read it or assign a value
to it. And in .NET, the data type is System.Inptr, not string.
Mar 26 '07 #6

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

Similar topics

1
1360
by: Sheri | last post by:
Our working environment traditionally has a new project (application) that has multiple developers within the development of that project. I need to know the best way to start development. Is it...
0
270
by: Doug | last post by:
I am working on an existing .NET (C Sharp) component that had a com interface that was used by a VB component. When it was originally written, it had the SSEAssemblyCom class below - minus the two...
1
1634
by: Kelly | last post by:
hi all, it's me again. i'm using ASP.NET Web Application, using a "File Field"component under HTML tab and i do a right click on the component and select "Run As Server Control". This was done...
1
2852
by: Notlwonk | last post by:
Not sure where to post this Q I am trying to write a Managed Exchange Server Event Sink (as a class library) in C# I have been following this tutorial step-by-step ...
1
1100
by: Kelly | last post by:
hi all, it's me again. i'm using ASP.NET Web Application, using a "File Field"component under HTML tab and i do a right click on the component and select "Run As Server Control". This was done...
1
1178
by: Kelly | last post by:
hi all, it's me again. i'm using ASP.NET Web Application, using a "File Field"component under HTML tab and i do a right click on the component and select "Run As Server Control". This was done...
10
3504
by: erin.sebastian | last post by:
Hello Everyone, I have code that uploads files in asp. It seems to be working however on files > 200kb it bombs and i don't know why. Does anyone have any idea of why this would occur and what i...
2
2125
by: tshad | last post by:
This has been driving me crazy. I have been trying to get the error handling working on my system and can get parts of it working and others won't work at all. I found that you can't access...
7
5123
by: Don | last post by:
Getting errors after following the MSDN article on using VB.NET (and VS2005) for "Implementing a Managed OnSave Event Sink" for Exchange Server 2007. Not sure, but part of the problem may be that...
1
1141
by: wvueagle84 | last post by:
I have the following code in which I am attempting to break a large image up in 16x16 blocks and perform some processing on those blocks. For debugging I would like to save each of the 16x16 blocks...
0
6967
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
7142
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,...
1
6847
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...
1
4875
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...
0
4565
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...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.