Windows Forms

Submitted by: 
Visitors have accessed this post 17458 times.

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


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

May be your download is corrupted. Kindly download again and tell me if you still have problem.


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]

Show me the code that has an error.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.