Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2003, 02:09 AM
Authorized User
 
Join Date: Sep 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to devrishi
Default COM and .NET

Hi there!!

Can i access DLLs writen in vb6 in .NET environment ?
Are ther some issues involved ?

I am planning an Intranet (using ASP .NET) and want to use
DLL writen in Visual Foxpro 6.0 and Visual Basic 6.0

Regards
Devrishi


 
Old September 30th, 2003, 12:09 PM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes you could use them. You might have to use an interop for them to run. An interop allows unmanaged code (vb6) to run with managed code (asp.net vb.net)

I would convert them from vb6 to VB.net and then use them in your application
 
Old September 30th, 2003, 01:49 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Though conversion is the best, you can use them as fantom222 stated. You will HAVE to use an interop assembly. An interop assembly is a wrapper around the COM object. All you need to do is add a new reference to your project, choose the COM tab, then find your registered COM object. VS will automatically run the tlbimp.exe program that's in the SDK directory to create the interop DLL which will live in the bin directory of your project. You will see a dll with a name matching your COM object (possibly proceeded by "Interop."). This DLL will be much smaller than the original COM DLL as it's only the wrapper for it. Remember that if you update any of the interfaces in the COM object you'll need to replace the reference inside of your .Net project so the interop can be regenerated for the updated COM. Once you have the reference in there you can just instantiate the objects in .Net the same way as any other .Net assembly (not by using the COM class ID).

I have spoken with some microsoft people while I was troubleshooting a COM interop problem and they told me something interesting about using COM classes in .Net. When you use a COM class you should dimension it and instantiate it like this (let's say our COM object is "ABC" and it has one class, "xyz"):

Dim objXYZ As ABC.xyz
objXYZ = New ABX.xyxClass

Apparently when tlbimp creates the interop, it creates the class wrapper (xyzClass) AND a class interface (xyz). MS says to dim it as the interface type, but to instantiate it as the class type. I started another thread in this forum regarding this.

Peter
 
Old October 1st, 2003, 03:35 AM
Authorized User
 
Join Date: Sep 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to devrishi
Default

thanx to both of you.
but
booohh!!!
as you said i have to recompile them....but what if my DLLs
are developed in Visual Foxpro 7.0

please help
Regards
Sunny

 
Old October 1st, 2003, 08:18 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That shouldn't matter, though I have not used Foxpro so I can't be sure. If you are creating a COM DLL, regardless of the development tool, you should have to go thru the same process of registering the DLL and adding them into (or updating them) in a VS.Net project.

Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I run VB .net 2005 with DOT NET 2003 APPLICATI kadesskade BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 August 8th, 2006 05:14 AM
Database diagram in .net using asp.net,c#.net scotttiger ADO.NET 2 February 16th, 2005 01:35 AM
Beginning ASP.Net Databases Using VB.Net ISBN 6195 tlamazares SQL Server ASP 1 December 15th, 2003 01:28 PM
CR.net With ASP.net using C#.net Nilesh Leuva Crystal Reports 1 September 11th, 2003 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.