Skip to main content

Windows Forms


Windows Form

This tutorial is part of Database Programming Made Easy Series.

Without Windows Forms your application may look like a DOS application, running in a black and white screen without a Graphical User Interface.

This tutorial will discuss on how to use different controls like TextBox, Label, ComboBox, Button, CheckBox, and finally the ListView Control to access data from our database.

We will use the code from the previous tutorial so you will have a better understanding on how to integrate those codes in different controls mentioned above.
This tutorial is limited only to the use of various controls above. If you want to know better about windows form I suggest you buy a book called “Microsoft Visual Basic 2008 Step by Step”.

The Label and TextBox Control

Even if you are a beginner, most probably you know what a Label and a TextBox Control is. Our goal for today is to retrieve data and put it in a TextBox and give it a descriptive title in a Label Control.

In our previous example you retrieve the data and show its output in a temporary textbox called remarks. We do that just to simplify our code.

Now we will go to the heart of Visual Basic .NET. Let us create our first Windows Form project to be use through the rest of the tutorial.

  1. Click Start >> Programs >> Microsoft Visual Studio 2008 and choose Microsoft Visual Studio 2008. This will open the Integrated Development Environment of VB.NET.
  2. Click File >> New >> Project
  3. Select Windows Form the left sidebar and select Windows Form Application in the right sidebar and named the project as “WindowsFormTutorial” as shown below.

[inline:New Project Dialog.jpg=New Project Dialog]

  1. Finally press OK button.
  2. Add a Label and a TextBox control as shown in the video tutorial below.

As you may know that there are different ways to access or retrieve data from a database. One is by using a Data Reader and other is using a Dataset and Data Adapter.

You can also save the data back to the database using ExecuteNonQuery Command or by using again a Dataset and Data Adapter.

Previous: How to Modify Data Using Datasets and Data Adapters

Next: How to Retrieve and Save Data using TextBox Control


Submitted byAnonymous (not verified)on Mon, 08/17/2009 - 12:26

Hi, I am Li Chin here. After i download the TextBox, i cant open the window from tutorial. It come out the message Unable to read the project"WindowsFormTutorial.vbproj'. Mai i know why can this happen?Thanks
Submitted byAnonymous (not verified)on Thu, 05/27/2010 - 00:24

Hi, I was wandering if you can help me. I am writing a system based on your tutorials. I have got to the point where I am wanting to write the data back to the db (MS ACCESS) but I keep getting this error: NullReferenceException was unhandled: Object reference not set to an instance of an object. please email me if you can: [email protected]

Add new comment