Roadmap › 1. .NET › Step 8
VB
VB.NET — Visual Basic .NET from Basics to Advanced (with C# Comparison)
VB.NET syntax and program structure, data types and Option Strict/Explicit/Infer, operators and control flow, procedures (Sub vs Function, ByVal/ByRef, Optional, ParamArray), arrays and collections, classes and OOP keywords (Inherits, Implements, Overridable, MustInherit, Shadows), properties, modules and Shared members, events and delegates (WithEvents/Handles/AddHandler), error handling (Try/Catch and legacy On Error), LINQ and XML literals, async, WinForms and Web Forms code-behind, and converting VB.NET to C#.
What it is & where it is used
Visual Basic .NET is a .NET language that compiles to the same IL as C# and uses the same CLR, base class library, ASP.NET, ADO.NET and Entity Framework. Many enterprise and government systems (especially .NET Framework Web Forms and WinForms apps from 2002–2015) are written in VB.NET, so developers are often hired to maintain or migrate them.
| VB.NET | C# | |
|---|---|---|
| Syntax style | English-like keywords, line-oriented, End If/End Sub | C-style braces and semicolons |
| Case sensitivity | Case-insensitive | Case-sensitive |
| Type | Dim x As Integer = 5 | int x = 5; |
| Same runtime/IL | ✅ | ✅ |
| New language features | Stable since 2020 (no new major features) | Evolving every year |
| Typical use today | Maintaining legacy apps, Office/VBA developers moving to .NET | Most new development |
Microsoft's position (2020): Visual Basic is supported on .NET 5+ for WinForms, WPF, console and class libraries, but will not get new language features and ASP.NET Core does not offer VB templates (Web Forms/MVC 5 on .NET Framework do).
Versions & history
| Version | Year | Shipped with | Highlights |
|---|---|---|---|
| VB 1.0–6.0 (classic) | 1991–1998 | Visual Studio 6 | COM-based, not .NET — VB6 apps are still migrated today |
| VB.NET 7.0 | 2002 | .NET Framework 1.0 | Full OOP, structured exception handling, .NET |
| VB 8.0 (2005) | 2005 | .NET 2.0 | Generics (Of T), My namespace, Using, operator overloading, partial classes, IsNot |
| VB 9.0 (2008) | 2007 | .NET 3.5 | LINQ, XML literals, Option Infer, lambdas, anonymous types, extension methods |
| VB 10 (2010) | 2010 | .NET 4.0 | Auto-implemented properties, multi-line lambdas, implicit line continuation, collection initializers |
| VB 11 (2012) | 2012 | .NET 4.5 | Async/Await, iterators (Iterator/Yield) |
| VB 14 (2015) | 2015 | Roslyn | NameOf, string interpolation $"...", ?. null-conditional, multiline strings, read-only auto-properties |
| VB 15–15.5 | 2017 | VS 2017 | Tuples, ByRef returns consumption, binary literals, digit separators |
| VB 16–16.9 | 2019–2020 | .NET Core 3 / .NET 5 | Comments after line continuation, init-only property consumption; final feature updates |
Lifecycle
How a VB.NET project runs:
- Write
.vbfiles (Visual Studio with VB project templates). - The VB compiler (
vbc, part of Roslyn) compiles them with project-level settings (Option Strict,Option Explicit, root namespace, imports) into IL in an assembly. - The CLR loads and JIT-compiles it exactly like C# output; VB-specific helpers live in
Microsoft.VisualBasic.dll(e.g.Left,Mid,CInt,Mynamespace). - C# and VB projects in one solution reference each other freely — they share the CTS types.
Tools used to develop
- Visual Studio (VB.NET project templates: Console, Class Library, WinForms, WPF; Web Forms/MVC on .NET Framework).
- Converters: Telerik Code Converter (online), ICSharpCode CodeConverter (VB ↔ C#, Visual Studio extension), SharpDevelop's converter (legacy).
- ILSpy can decompile an assembly to either language — useful to see the C# equivalent of VB code.
- .NET Upgrade Assistant for migrating .NET Framework VB projects to modern .NET.