Introduction to Windows Forms Application in Visual Basic 2010

Introduction to Windows Forms Application in Visual Basic 2010

Visual Basic is best known for being a Windows Forms Application programming language. In the previous articles we only discussed about Console Applications which ran on CMD windows. It is necessary to first get familiar with the syntax used in Visual Basic and then go on to building Windows Applications.

To Start coding Windows Forms Application, click on New Project and then select Windows Forms Application, name it and click ok.

A simple Windows Forms Application platform in Visual Basic 2010 will simply look like;

Forms

How Visual Basic Looks Like in Windows Forms Application?

  1. Menu-bar and Toolbar: Which includes the Menu and all the tools needed to modify your project. An important part of the toolbar here is the toolbox which is also accessible with (Ctrl + Alt + X).
  2. Side Bar: It includes the Toolbox which brings you all the tools you need to build a useful Windows Forms Application project. You can also find the Data Sources in the side bar.
  3. Work Area: This is the main platform where the project has to be developed. It includes the Design Window and the form Window both.
  4. Solution Explorer: It contains all the necessary information about the project you are working on. Moreover; it defines the path of the project.
  5. Properties: This is the properties windows. All the characteristics of the Windows Forms Application can be utilized here. As we move further and build different Windows based Applications, we will be explaining the toolbox and property windows more.
  6. Error List: includes the errors and faults in the piece of code you have built and gives you the possible warnings that may result into an error. It also includes messages.

ToolBox:

ToolBox

It has all the necessary and additional tools which are necessary to modify your forms and projects. Whenever you need any tool you just double click on it or drag and drop it in your form. It is important to remember that all the tools in the toolbox can be modified according to the choice of the programmer in the properties window. Some of the frequently used and basic tools in the toolbox are:

Button: It is used to create a button which can help you executing pieces of codes.

Check Box: Gives you the chance to check mark certain entities.

Checked List Box: It is used to create a list of items where you can check mark your choices.

Combo Box: Creates a list of items that can be scrolled.

Date Time Picker: Creates a Date & Time in the windows you have created.

Label: It is only used to give labels to other entities or tools used in the form.

Link Label: Gives the user a chance to link a website or something to the form.

Properties Window:

This window is used to modify the entities or tools used in the form. This modification can be in the form of changing the name, changing the size, putting a background color or image for the form, placing the entities to the right place in the form, and etc. As much as you play with the properties windows you get familiar with it and you can design the suited choice of your Application.

Check also:   Elements in HTML5

How to create forms and write codes in Windows Forms Application?

  1. Create your form
  2. From the ToolBox, pick a button for your form.
    Forms
    You can change the properties of the button from the properties windows. For the button we have picked we have changed its name and the text on it. Check below:
    Name Changed:
    BtnWelcome
    Text on the Button Changed:
    Click Here
  3. Double click on your form and the code window will open. It will load your form.
  4. In the design window, double click on the button you just created. It will create a separate sub for the button in the code window.
  5. Create a MessageBox in the code window and type in your message there. As below:
  6. Run your form or project.
    Once you run your project, a window will pop up. It will contain the button you created. If you click on the button, it will show the message that you had typed in it.

Check also:   Math Operators and Getting User Inputs in Visual Basic

“Welcome” Program in Windows Forms Application:

Output:

Output1

Output2

Looking forward to receiving your great responses and ideas on our articles.

Previous 5 Most Popular Functions in Excel
Next Message Boxes In Visual Basic 2010

About author

Bahonar Javid
Bahonar Javid 43 posts

* Computer Application Student * Co-Founder of www.codejow.com * Love to code and Learn new languages * Enjoy playing football

View all posts by this author →

You might also like