Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 36 ยท Getting Started

What Is Visual Basic .NET?

Learn what Visual Basic .NET is, how it differs from classic VB6 and VBA, what it runs on, where it is still used and what the status of the language is today.

Visual Basic .NET (usually written VB.NET or just VB) is a modern, object-oriented programming language for the .NET platform. Its syntax reads almost like English: If, Then, End If, For Each, Sub, Function. That makes it one of the friendliest languages for people who are new to programming, and one of the most readable languages for people who maintain business software for years.

This lesson explains where VB.NET comes from, what it is good at, how it relates to other Basic dialects you may have heard of, and how this course teaches it. Read the honesty note near the end first if you want to know exactly what you can run on this website.

A short history

Basic was invented in 1964 to let students program without a degree in computer science. Microsoft built several products on it:

  • Visual Basic 1 to 6 (1991 to 1998): a drag-and-drop tool for Windows programs. VB6 is a different language from VB.NET, even though they look alike. It is no longer supported.
  • VBA (Visual Basic for Applications): the macro language inside Excel, Word and Access. It is covered in its own track on this site.
  • Visual Basic .NET (2002 and later): a complete rewrite on top of the .NET platform, with real classes, inheritance, generics, exceptions and, later, LINQ and Async/Await.

The jump from VB6 to VB.NET broke old code, which is why migration is still a topic today (see the "Interop and Migration" chapter).

VB.NET is not the same as VBA or VB6. If you open an old Excel macro you are looking at VBA. This course teaches VB.NET: a compiled, statically typed language with the whole .NET class library behind it.

How VB.NET runs

VB.NET code is compiled by the Visual Basic compiler (vbc, part of the .NET SDK) into Intermediate Language (IL) stored in a .dll or .exe file. When you run the program, the Common Language Runtime (CLR) turns IL into machine code just in time and manages memory with a garbage collector. Every .NET language uses the same pipeline, so VB.NET, C# and F# can call each other's libraries.

flowchart LR
    A["Program.vb<br/>source code"] --> B["VB compiler (vbc)"]
    B --> C["App.dll<br/>IL + metadata"]
    C --> D["CLR: JIT compiler<br/>+ garbage collector"]
    D --> E["Machine code<br/>running program"]

Figure: the same pipeline is used by every .NET language.

Because of that shared runtime, a VB.NET program can use anything in the .NET base class library: collections, files, networking, JSON, dates, threading, databases and more. The language only decides how you write the code. The library decides what you can do.

What it looks like

Here is a complete small VB.NET program. The next lessons explain each piece, so just get a feel for the shape now.

VB
Module Program
    Sub Main()
        Dim name As String = "Ada"
        Dim age As Integer = 36

        If age >= 18 Then
            Console.WriteLine($"{name} is an adult.")
        Else
            Console.WriteLine($"{name} is a minor.")
        End If
    End Sub
End Module

Notice what is missing compared with C-style languages: there are no curly braces and no semicolons. Blocks end with explicit End ... keywords, a statement ends at the end of the line, and keywords are case-insensitive by convention (the editor fixes the casing for you).

What VB.NET is used for

  • Windows desktop applications with Windows Forms and WPF: internal business tools, data-entry screens, reporting front ends.
  • Line-of-business software that was written in the 2000s and still runs payroll, inventory or accounting. Many companies employ VB.NET developers for exactly this.
  • Web applications and services with ASP.NET (classic Web Forms, and Web API on the .NET Framework).
  • Console tools, scripts and libraries that other .NET code can reference.
  • Office add-ins and automation that talk to Excel or Outlook through COM.

The status of the language today

Microsoft still ships a VB compiler and supports VB.NET on .NET (the current cross-platform .NET, not only the old Windows-only .NET Framework). The language is considered stable: it receives compatibility and tooling fixes but not new language features, while C# and F# keep evolving. Some project types, such as ASP.NET Core, do not offer VB templates. In practice this means:

  • VB.NET is an excellent choice for maintaining and extending existing applications and for learning the .NET platform with gentle syntax.
  • For brand-new web projects most teams choose C#, and everything you learn about the .NET library and object-oriented design transfers directly.
  • You can mix languages in one solution: a VB project can reference a C# library and vice versa.

How this course is organized

  1. Getting Started: setup, your first program, how a project is built.
  2. Syntax and Types: variables, operators, strings, conversions.
  3. Control Flow and Procedures: decisions, loops, Sub and Function, error handling.
  4. Classes and Objects: properties, inheritance, interfaces, events.
  5. onward: collections and LINQ, Windows Forms, files and databases, interoperability, projects.

Open the track page any time to see the whole list.

An honest note about running code on this site

This website can run code in the browser or on a server, but it has no Visual Basic compiler. So every VB.NET listing in this course is shown as a read-only code block, and we only print its output when we are completely sure what it is. To let you experiment anyway, most lessons add a runnable C# stand-in: a small program that does the same job with the same .NET classes, so you can change numbers, run it and see the behavior. These stand-ins are clearly labelled. To run real VB.NET on your own computer, follow the next lesson.

Here is the first stand-in. It does what the program above does, but written in C# so the site can run it. Change age and run it again.

C# Stand-in (C#): the same logic as the VB.NET program above

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with Console.ReadLine()), it gets the next line from this box.

The comparison of the two languages is a theme of its own: see VB.NET and C# side by side.

The .NET class library works the same way

Because VB.NET and C# share the library, the types you meet are identical. Here is a second stand-in that uses a few base-class types you will use constantly in VB.NET (DateTime, TimeSpan, Math, String).

C# Stand-in (C#): the shared .NET base class library

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with Console.ReadLine()), it gets the next line from this box.

In VB.NET the same calls read end - start, Math.Sqrt(144), "visual basic".ToUpperInvariant() and String.Join(", ", {"VB", "C#", "F#"}). Only the surface syntax changes.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which statement about VB.NET and VB6 is correct?

    VB.NET (2002) replaced VB6 with a new language on the CLR. The syntax looks familiar, but old VB6 code needs migration work.
  2. 2. What does the VB compiler produce?

    All .NET languages compile to IL. The CLR compiles IL to machine code just in time.
  3. 3. Why can a VB.NET project reference a library written in C#?

    The shared CLR and metadata format make .NET languages interoperable.
  4. 4. Which is a typical use of VB.NET today?

    VB.NET is strongest in Windows desktop, business and Office-related software that already exists.

Summary

  • VB.NET is a modern, object-oriented .NET language with English-like syntax; it is not VBA or VB6.
  • Source code is compiled to IL and executed by the CLR with a garbage collector.
  • It uses the full .NET class library, shared with C# and F#.
  • The language is stable and maintained; it shines for desktop and business applications.
  • This site shows VB.NET read-only and offers labelled C# stand-ins you can run.

Next: Setting Up and Your First Program