VB2022 VB2019 VB6 VB Sample Code About Us

Lesson 1: Introduction to VB2022


1.1 Introduction

Microsoft released Visual Studio 2022 in early 2022. VS 2022 allows you to code in different programming languages for different platforms, Visual Basic 2022 is one of them. The other Programming languages are C#  C++, F#, JavaScript, Java and Python. Visual Basic 2022 is the latest version VB.NET programming language released by Microsoft.

You may download the free version of Visual Studio 2022 from the following link:

https://visualstudio.microsoft.com/vs/

After downloading and installing VS 2022, you are now ready to launch Visual Studio 2022 and start programming in Visual Basic 2022.

1.2 Visual Studio 2022 Start Page

The VS2022 start page is quite different from VS 2017. When you first launch  Visual Studio 2022, the following start Page appears, as shown in Figure 1.1. You can quickly launch recently open recently opened projects, clone from GitHub, open a project or solution, open a local folder or create a new project.

Figure 1.1   Visual Studio 2022 Start Page

Let's select Create a new project option and launch the Create a new project page, as shown in Figure 1.2. We select the Visual Basic language

Figure 1.2  New Project Page 

The Visual Studio 2022 start page offers a much simpler UI than VS2019, it comprises four options: clone a repository, open a project or solution, open a local folder, or create a new project. Let us create a new project by clicking the Create a new project option. You will see the Create a new project template page, as shown in Figure 1.3. There are a dozen templates to choose from, scroll down to select WPF application.

Figure 1.3  Select Project Template 

Upon clicking the selected project template, the project configuration page appears, as shown in Figure 1.4. You can configure your project by typing the project name and select a few other options.

Figure 1.4  Configuring Project 

1.3 Visual Basic 2022 IDE

Clicking the Create button will launch the  Visual Basic 2022 IDE, as shown in Figure 1.5. You can see that the name of the project you entered earlier appears on the top right corner of the IDE.

 Figure 1.5 Visual Basic 2022 IDE

VB2022 IDE comprises a few windows, the Form window, the Solution Explorer window and the Properties window. The Toolbox is not shown until you click the Toolbox tab. When you click the Toolbox tab or use the shortcut keys Ctrl+Alt+x, the common controls Toolbox will appear, as shown in Figure 1.6. You can drag and move your toolbox around and dock it to the right, left, top or bottom of the IDE.

Figure 1.6 The Design Interface

Next, we shall proceed to show you how to create your first VB2022 application. First, change the text of the form to ‘My First VB 2022 Application’ in the properties window; it will appear as the title of the application. Next, insert a button and change its text to OK. The design interface is shown in Figure 1.7

Figure 1.7 The Design Interface

Now click on the OK button to bring up the code window and enter the following statement between Private Sub and End Sub procedure, as shown in Figure 1.8

Figure 1.8  Visual Basic 2017 Code Window

When you run this program and click on the Display Hidden Message button, you should get the following popup message box.

 Figure 1.9 The Message Box

The function MsgBox is a built-in function of Visual Basic 2022 that displaysthe text enclosed within the brackets. Now you have created your first program in Visual Basic 2022, we shall learn more Visual Basic 2022 programming techniques in coming lessons.


❮ Home Next lesson ❯


Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy