Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Visual Basic .NET is Microsoft's object-oriented, BASIC-family language, released in 2002 as part of the first .NET Framework and a full redesign of classic Visual Basic 6. It pairs an approachable, keyword-heavy syntax - Dim, Sub, Function, If...Then - with the same managed runtime, garbage collection, and Base Class Library that C# uses, so the two languages can call the same .NET APIs. Microsoft has placed the language in a stable, supported state: it still ships and runs on modern .NET, but new language features and frameworks now target C# first. It stays in wide use maintaining line-of-business applications across enterprises that adopted it in the 2000s. On XCODX your code is compiled and run as a console program on the .NET runtime (the version is shown in the badge) in a cloud sandbox, so you write to Console.Out and read from Console.In rather than opening a form.
Imports System
Module Program
Sub Main()
Dim total As Integer = 0
For i As Integer = 1 To 10
total += i
Next
Console.WriteLine("Hello from VB.NET!")
Console.WriteLine("Sum of 1 to 10 = " & total)
End Sub
End Module
Visual Basic .NET's strengths are readable syntax, full access to the .NET Base Class Library, and compile-time type checking without manual memory management, which suits maintaining and extending existing business applications. Choose it when a team already has a VB.NET codebase, or when its wordier, English-like style helps people coming from spreadsheet macros or classic Visual Basic. For brand-new .NET work most teams pick C#, since new features and frameworks target it first and its community is larger. In this sandbox it is best for console logic, algorithms, and practicing the .NET standard library rather than the Windows Forms apps it is often used for in production.
Console.ReadLine() reads one line from standard input and returns it as a String, so numeric input must be converted with Integer.TryParse or Convert.ToInt32. XCODX gives you a live terminal that streams what you type, or a Stdin Box where you paste all input before running; ReadLine blocks until it gets a line and returns Nothing at end of input, which you signal with Ctrl+D. There is no InputBox here because the sandbox has no GUI.
No. The sandbox compiles your code on the .NET runtime with no package manager and no network, so NuGet packages and dotnet add package are unavailable. You still get the full .NET Base Class Library - System, System.Text, System.Collections.Generic, System.Linq and more - so anything in the standard library works with the right Imports. Third-party dependencies simply will not resolve here.
Both compile to the same .NET intermediate language and can use the same libraries, so they match closely in capability; the differences are mostly syntax and direction. VB.NET uses wordier English-like keywords such as Sub, End If, and Nothing, while C# uses C-style braces and semicolons, and Microsoft now adds new language features to C# first. For maintaining VB.NET code it is a fine choice, but new projects usually start in C#.
No, but it is in maintenance mode. Microsoft keeps it supported and running on current .NET for bug fixes and compatibility, yet it no longer receives major new language features, and newer frameworks target C#. Large amounts of business software written in VB.NET are still maintained, so the language is used, just not the default for new projects.
No. The sandbox only runs console programs, so there is no form designer, no window, and no way to show a message box or bind to a port. There is also no network access, so web requests and database connections will not work. Use Console.WriteLine and Console.ReadLine for input and output, and treat it as a place to practice language and Base Class Library features.
A console program needs one entry point, and the portable form here is a Module that contains Sub Main(), where execution begins. Put your code inside Sub Main and add Imports System at the top to use Console directly. Wrapping everything in a Module rather than a Class means you do not have to create an instance before it runs.
main.vbvbConsole.ReadLine()Imports System
Module Program
Sub Main()
Console.WriteLine("Hello from BASIC.NET!")
End Sub
End Module