Visual Basic tutorial: Hello world

This tutorial helps you get started with Visual Basic. It explains what you need to write your first Visual Basic program. It starts with the basics: you will learn where you can find and download the tools needed, how to install these tools and it will take you all the way to building and running your code. If you have never written a Visual Basic program before this is the place to start. We have created this article, so you can get started with Visual Basic, and move on to our sms examples. If you are already familiar with Visual Basic, you can jump directly to one of the following SMS projects.

VB sms examples:

VB send sms with the HTTP rest api (code sample)
VB send multiple sms with the HTTP rest api (code sample)
VB schedule sms with the HTTP rest api (code sample)
VB receive sms with the HTTP rest api (code sample)
VB delete sms with the HTTP rest api (code sample)
Download the latest Visual Basic sms api library from Github

What is Visual Basic

Visual Basic is a programming language. It is similar to a natural language, like English. It is used to talk to a computer. The major difference between a natural language and a programming language is that programming languages have a more rigorous structure, to help the computer understand it better.

What is Visual Studio

Visual studio is a tool to write a Visual Basic program. Visual studio allows you to type in text using the Visual Basic language, and it makes it possible for you to tell the computer, to read the text and execute the instructions. We use the term "Run" to tell computer to execute the instructions.

What is a Visual Basic Hello world program

The Visual Basic hello world program is the simplest program you can write. It simply prints out the sentence: Hello world on the computer screen. The Hello World program is the first program developers write in any programming language.

How to write your first program in Visual Basic

To write your first program in Visual Basic:

  1. Setup Visual Studio
  2. Create a new Visual Studio project
  3. Select Console Application
  4. Name the project
  5. Choose .NET for Target Framework
  6. Write Hello World program in Visual Basic
  7. Run the Hello World program
  8. Check the output

Prerequisites

Here is what you need to get started. To write your first computer program in Visual Basic, you need a Windows computer, the Visual Studio programming environment and example code presented below.

  • Windows 10 computer
  • Microsoft Visual Studio Community Edition
  • Ozeki Hello World example project

Download Visual Studio (Video tutorial)

Microsoft Visual Studio Community Edition

In this video, we are going to show you how to download Visual Studio. It will start with opening your browser and will take you all the way to having the installer on your computer. You will learn what page to visit and what button to look for if you want a free version of the software. This video is only 40 seconds long, but it contains all the information you need to download the Microsoft Visual Studio Community Edition. You may download the installer from the following URL: https://visualstudio.microsoft.com/downloads/.

Video 1 - How to download Visual Studio (Video tutorial)

Install Visual Studio (Video tutorial)

In the following video, you will be presented with the process of installing Visual Studio. The video will start with the opened downloads folder with the installer visible there. At the end of the video, you will have a copy of Visual Studio installed on your computer. We assume that you already downloaded the installer file. You will learn what to do in each of the steps and how to set up the program. This video is only 2:40 long and it is very detailed. You can get all the information you need from it.

Video 2 - How to install Visual Studio (Video tutorial)

Create your first visual studio project (Video tutorial)

From this video, you will learn how to create a new project in Visual Studio. The video will start with opening the Visual Studio for the first time. At the end of the video, you will have a project that you can start to work with. You will also learn what settings you need to do to have a usable project file. The video itself is only 41 seconds long, very detailed, and easy to follow. You will have no problem with understanding the steps.

Video 3 - How to create your first visual studio project (Video tutorial)

Create a new project

First, open Visual Studio, which you have just installed. You will be then greeted by a welcome screen. This screen lets you create a new project or open previous ones. Under the "Get Started" column on the right, click on Create a new project (Figure 1). This will forward you to the next page where you can configure the settings of your project.

create new project
Figure 1 - Create new project

Choose VB Console Application

After you have clicked on "Create a new project" you will be brought to a configuration screen. In order to create a Visual Basic, you will first need to select the Visual Basic Console Application template (Figure 2). Click on this option to select it. Then, click on the Next button on the bottom left to continue.

console application
Figure 2 - Choose VB Console Application

Name your project

After specifying your project as a Console Application, you will be asked to give it a name. Under the text that reads "Project name" you will find a textbox (Figure 3). Enter your desired name into this textbox to name your project. Give it an easily identifiable and fitting name, so you could always recognize it. Click on the Next button on the bottom right when you are done.

project name
Figure 3 - Write the project name

Choose target framework

To finalize your project configuration, you need to select a targeted framework. This can be done on the last configuration page. You can select a targeted framework from the combo box by clicking on it (Figure 5). Here we select .NET Core 3.1. This is a good choice for your project. Click on the Create button on the bottom right to create your project.

target framework
Figure 4 - Target framework

Write your 'hello world' program in Visual Basic

The first program you write in any programming language is the 'Hello world' program. The sole aim of this program is to print the term 'Hello world' to the computer screen. In this example the program consists of two lines of code: The first line: Console.WriteLine prints the text.