Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.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 8th, 2003, 09:39 AM
Authorized User
 
Join Date: Sep 2003
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
Default Can you write an ActiveX DLL with VB.NET?

Hi,

I need to write an ActiveX DLL for use in an Excel spreadsheet.

Question:

Can I write an ActiveX DLL using "Visual Basic .NET Standard Edition"?

I am new to .NET so am not sure if the new .NET version of VB allows you to write an ActiveX DLL (for use, say, in a VBA application).

If it is possible, please tell me where to start.

Hope you can help.

Thanks.

James


 
Old September 8th, 2003, 09:46 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you are using Visual Studio.Net, this is pretty simple. View the properties of a .Net project. Go to "Configuration Properties" then "Build". Under "Output Path" there is a checkbox for "Register for COM Interop". This will automatically register the .Net assembly for access from standard COM.

Alternative to this is the "regasm.exe" program that comes with .Net. Just type "regasm" at a command prompt and you should get the command-line help for that exe. This will do the same thing that VS.Net does. After compilation, this registers the .Net DLL with the registry for access from COM.

Peter
 
Old September 8th, 2003, 10:32 AM
Authorized User
 
Join Date: Sep 2003
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks, Peter.

Am I right in thinking that Excel 2002 is a COM-based application? i.e. to write a bespoke class for it (outside of VBA) I must write a COM object (DLL)?

Or... am I making things too difficult - perhaps I can simply write a .NET class that Excel can use.. I don't know, because it is all rather new to me.

Hope you can help.

Many thanks.

James

 
Old September 8th, 2003, 11:07 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I think you are misunderstanding things...

If have an application for which you would like to write a COM object you have two options:

1. Write in pre-.Net VB and create an ActiveX COM DLL
2. Write a .Net assembly, and use regasm.exe to register that .Net assembly for use by COM.

The latter gives you the flexibility of writing a much more useful and robust .Net assembly (that runs under the framework) but is accessible to both .Net and COM.

Peter
 
Old November 18th, 2006, 01:19 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you ever get your excell spreadsheet able to access the .net exe??

I have a similar problem in Access trying to "see" a .net dll. Do you know what to do?

Walt (desperate)






Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I build a ActiveX DLL in VS.net 2003 ? Mohammed ASP.NET 1.0 and 1.1 Basics 13 July 13th, 2006 10:47 AM
how to use ActiveX DLL in VB.NET debuajm General .NET 4 June 6th, 2004 05:26 AM
Can you write an ActiveX DLL with VB.NET? james gold VB.NET 1 September 8th, 2003 09:49 AM
Can you write an ActiveX DLL with VB.NET? james gold VB Components 0 September 8th, 2003 09:44 AM
Can you write an ActiveX DLL with VB.NET? james gold VB.NET 2002/2003 Basics 0 September 5th, 2003 05:25 AM





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