|
 |
aspx thread: Calling COM components from C#
Message #1 by Lars Solem <Lars.Solem@v...> on Fri, 17 Nov 2000 09:17:20 +0100
|
|
Hi,
I've just started to peek into the .NET world generally and C# in
particular. My first obstacle is that I can't find a way of using an
existing COM component. In VBScript, i used something like
dim cObj
set cObj = Server.CreateObject("MyProj.MyObj.1")
How do I do the same thing in C#?
(MyProj.MyObj is made in C++)
Regards, Lars
Message #2 by "Fredrik Normen" <fredrik.normen@e...> on Fri, 17 Nov 2000 17:35:33 -0000
|
|
Are you using Visual Studio.NET Beta 1 ?
If so you can simple add a reference to you COM component.
We say that you want to use the old ADO.
First you right click on the reference node in the Solution explorer.
Choose to add a reference, after that select COM and choose Microsoft
ActiveX Data Object 2.x.
Now you can simply write:
using ADODB;
....
Connection myCOnnection = new Connection();
Most COM components will continue to work under ASP.NET. You can still
implement late binding using Server.CreateObject as with previous versions
of ASP
/Fredrik Normén
Message #3 by Lars Solem <Lars.Solem@v...> on Tue, 28 Nov 2000 09:17:05 +0100
|
|
Thanks Fredrik, it worked!
But..
I used the PDC version on an w2k Advanced Server and added a 'using
MYCOMPLib;' to my ASP+ WEB Application (C#), accessed my component and
had a
good life. Then I installed a new VS.NET (beta 1 from MSDN website) on
a w2k
Professional and tried the same thing. When I try to add the 'using
MYCOMPLib;' I get a "The type or namespace name 'MYCOMPLib' does not
exist
in the class or namespace 'MyWorkspace'"
I still use my old asp pages and access my component on the same
computer,
so I know the component is registered and fit for fight.
What am I missing? Please help!
Thanks, Lars
-----Original Message-----
From: Fredrik Normen [mailto:fredrik.normen@e...]
Sent: 17. november 2000 18:36
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Are you using Visual Studio.NET Beta 1 ?
If so you can simple add a reference to you COM component.
We say that you want to use the old ADO.
First you right click on the reference node in the Solution explorer.
Choose to add a reference, after that select COM and choose Microsoft
ActiveX Data Object 2.x.
Now you can simply write:
using ADODB;
....
Connection myCOnnection =3D new Connection();
Most COM components will continue to work under ASP.NET. You can still
implement late binding using Server.CreateObject as with previous
versions
of ASP
/Fredrik Norm=E9n
Message #4 by =?iso-8859-1?Q?Fredrik_Norm=E9n?= <fredrik.normen@e...> on Tue, 28 Nov 2000 10:54:13 +0100
|
|
Hi,
Have you add a refenrece to your component in VS.NET ?
/Fredrik Normén
-----Original Message-----
From: Lars Solem [mailto:Lars.Solem@v...]
Sent: den 28 november 2000 09:17
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Thanks Fredrik, it worked!
But..
I used the PDC version on an w2k Advanced Server and added a 'using
MYCOMPLib;' to my ASP+ WEB Application (C#), accessed my component and had a
good life. Then I installed a new VS.NET (beta 1 from MSDN website) on a w2k
Professional and tried the same thing. When I try to add the 'using
MYCOMPLib;' I get a "The type or namespace name 'MYCOMPLib' does not exist
in the class or namespace 'MyWorkspace'"
I still use my old asp pages and access my component on the same computer,
so I know the component is registered and fit for fight.
What am I missing? Please help!
Thanks, Lars
-----Original Message-----
From: Fredrik Normen [mailto:fredrik.normen@e...]
Sent: 17. november 2000 18:36
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Are you using Visual Studio.NET Beta 1 ?
If so you can simple add a reference to you COM component.
We say that you want to use the old ADO.
First you right click on the reference node in the Solution explorer.
Choose to add a reference, after that select COM and choose Microsoft
ActiveX Data Object 2.x.
Now you can simply write:
using ADODB;
....
Connection myCOnnection = new Connection();
Most COM components will continue to work under ASP.NET. You can still
implement late binding using Server.CreateObject as with previous versions
of ASP
/Fredrik Normén
Message #5 by Lars Solem <Lars.Solem@v...> on Tue, 28 Nov 2000 10:22:58 +0100
|
|
I just found out my errata. Forgot to add the reference in Solution
explorer. Sorry for disturbing!
Regards, Lars
-----Original Message-----
From: Lars Solem
Sent: 28. november 2000 09:17
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Thanks Fredrik, it worked!
But..
I used the PDC version on an w2k Advanced Server and added a 'using
MYCOMPLib;' to my ASP+ WEB Application (C#), accessed my component and
had a
good life. Then I installed a new VS.NET (beta 1 from MSDN website) on
a w2k
Professional and tried the same thing. When I try to add the 'using
MYCOMPLib;' I get a "The type or namespace name 'MYCOMPLib' does not
exist
in the class or namespace 'MyWorkspace'"
I still use my old asp pages and access my component on the same
computer,
so I know the component is registered and fit for fight.
What am I missing? Please help!
Thanks, Lars
-----Original Message-----
From: Fredrik Normen [mailto:fredrik.normen@e...]
Sent: 17. november 2000 18:36
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Are you using Visual Studio.NET Beta 1 ?
If so you can simple add a reference to you COM component.
We say that you want to use the old ADO.
First you right click on the reference node in the Solution explorer.
Choose to add a reference, after that select COM and choose Microsoft
ActiveX Data Object 2.x.
Now you can simply write:
using ADODB;
....
Connection myCOnnection =3D new Connection();
Most COM components will continue to work under ASP.NET. You can still
implement late binding using Server.CreateObject as with previous
versions
of ASP
/Fredrik Norm=E9n
Message #6 by Nagendra <Nagendra@q...> on Tue, 28 Nov 2000 15:21:42 +0530
|
|
COM components are not directly compatible with .Net framework,
(i dont know if .Net components are compatible with com however)
u have to convert a component into a .Net type of dll using tlbimp
how to use it?
-- goto command prompt
tlbimp <Filename/path>
it will create a dll in the current directory,
note this dll cannot be registered.
copy this dll into the
<SystemDrive>:\WINNT\Microsoft.Net\Framework\<***
whateever beta version - here v1.0.2204>
or copy it into the application directory wher u want to use the dll &
then
u will be able to use the current components.
u cannot use the current components directly, unless u use
server.createobject (in vb) to instantiate it explicitly
for more info read .Net framework documents & help on using com
components
Regards
Nagendra
=D7=B7.=B8=B8.=B7=B4=A8)
=B8. =B7=B4 =B8.=B7=B4=A8)
(_=B8.=B7=B4 =B8.=B7=B4 =B8.=B7=D7
(_=B8.=B7=B4
Thanks Fredrik, it worked!
But..
I used the PDC version on an w2k Advanced Server and added a 'using
MYCOMPLib;' to my ASP+ WEB Application (C#), accessed my component and
had a
good life. Then I installed a new VS.NET (beta 1 from MSDN website) on
a w2k
Professional and tried the same thing. When I try to add the 'using
MYCOMPLib;' I get a "The type or namespace name 'MYCOMPLib' does not
exist
in the class or namespace 'MyWorkspace'"
I still use my old asp pages and access my component on the same
computer,
so I know the component is registered and fit for fight.
What am I missing? Please help!
Thanks, Lars
-----Original Message-----
From: Fredrik Normen [mailto:fredrik.normen@e...]
Sent: 17. november 2000 18:36
To: ASP+
Subject: [aspx] Re: Calling COM components from C#
Are you using Visual Studio.NET Beta 1 ?
If so you can simple add a reference to you COM component.
We say that you want to use the old ADO.
First you right click on the reference node in the Solution explorer.
Choose to add a reference, after that select COM and choose Microsoft
ActiveX Data Object 2.x.
Now you can simply write:
using ADODB;
....
Connection myCOnnection =3D new Connection();
Most COM components will continue to work under ASP.NET. You can still
implement late binding using Server.CreateObject as with previous
versions
of ASP
/Fredrik Norm=E9n
|
|
 |