Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
-->
TitleUse a VB .NET assembly from Visual Basic 6
DescriptionThis example shows how to use a VB .NET assembly from Visual Basic 6.
KeywordsVB6, Visual Basic 6, VB.NET, Visual Basic .NET, DLL, assembly
CategoriesVB.NET
 
In the .NET project:

  • Select Project\Properties. Open the Configuration Properties folder, select the build tab, and check "Register for COM Interop."
  • Set the project's name to something meaningful. E.g. NetTools.
  • Add the following in front of the Class statement to expose the class to VB 6:

        <ClassInterface(ClassInterfaceType.AutoDual)> _ 

    If you don't do this, the VB 6 program can still use the class but IntelliSense won't know anything about its properties and methods.

In the VB 6 project:

  • Select Project\References. Select the DLL. E.g. NetTools.
  • Use the Public classes in the DLL.

This works pretty well if you are running VB .NET and VB 6 on the same computer. If you don't build the .NET assembly on the VB 6 computer, you need to perform some extra actions to register it so VB 6 can work with it. See this article on the VB Rad Web site for more instructions and some very insightful discussion.

 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated