Classic VB6 and Migration
52.1 VB6 Essentials (for Maintenance)
VB6 is COM-based. Forms (.frm), modules (.bas), classes (.cls), user controls (.ctl), and projects (.vbp).
Features: Variant, Set, On Error, default properties (Text1 = "x"), control arrays, Collection, ActiveX DLL/EXE/OCX components, ADO/DAO database access, Win32 API Declare.
The VB6 runtime still ships with Windows 10/11 ("It Just Works" support), but the IDE is unsupported (it runs on modern Windows with tweaks).
52.2 Migration Strategies
Maintain as-is (risky long-term) Expose new.NET components to VB6 via COM, then migrate gradually
Tools: Mobilize.Net VBUC, VB Migration Partner, (the old VS 2008 Upgrade Wizard is no longer available)
Redesign in VB.NET/C# with modern architecture (most work, best result)
52.3 Key Differences When Migrating VB6 → VB.NET
Integer 16-bit, Long 32-bit Short 16-bit, Integer 32-bit, Long 64-bit Set obj = New X Default properties (Label1 = "Hi") Explicit: Label1.Text = "Hi" Fixed-length strings String * 10
<VBFixedString(10)> or regular strings Arrays with lower bound ≠ 0
Event handlers with Handles a.Click, b.Click or dynamic controls Type...End Type Form1.Show (global default instance)
Explicit instances (My.Forms for compatibility) ByRef is the default ByVal is the default Implicit Variant declarations Option Strict / Explicit Printer object DAO/ADO recordsets ADO.NET / EF Core
The Microsoft.VisualBasic.Compatibility namespace was used historically (it's deprecated, so avoid it in new code).