|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Component Authoring for Visual Basic 6.0 Users
Although both Visual Basic 6.0 and Visual Basic 2005 provide capabilities for creating components, there are some important differences in component authoring.
In Visual Basic 6.0, component authoring is all about creating COM components: ActiveX Controls, ActiveX DLLs, and ActiveX EXEs that can be used in COM applications.
In Visual Basic 2005, components are based on the .NET Framework; you create components that can be used in applications built using the .NET Framework. Components built with Visual Basic 2005 are based on inheritance—every component derives from either the Component or Control base class. For more information, see.
Visual Basic 6.0 provides two models for threading—components can either be single threaded or apartment threaded.
Visual Basic 2005 supports true multithreaded components. For more information, see.
In Visual Basic 6.0, the Instancing property of a class controls the access level and the way a component can be created.
In Visual Basic 2005, setting the access modifier and access level in the constructor for a component class controls instancing. For more information, see.
Binary Compatibility and Versioning
Binary compatibility for components is important in Visual Basic 6.0 in order to prevent version conflicts; it is controlled by the Version Compatibility property for the component project.
In Visual Basic 2005, versioning is built into the assemblies for components; you no longer need to worry about setting binary compatibility. For more information, see.
In Visual Basic 6.0, you can create ActiveX controls (also referred to as user controls) that can be used in Windows-based applications.
In Visual Basic 2005, you can create user controls for Windows Forms, or you can inherit from existing controls to add functionality. For more information, see.
In Visual Basic 6.0, you can create components that use Microsoft Message Queuing (MSMQ) to pass information between applications.
In Visual Basic 2005, messaging is built into the .NET Framework. For more information, see.
In Visual Basic 6.0, you can create MTS components that work with Microsoft Transaction Server (MTS) to participate in transactions.
With Visual Basic 2005, transactions are handled by the .NET Framework by adding a transactional component to your project or by adding a Transaction attribute to an existing class.