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.
- Click Start >> Programs >> Microsoft Visual Studio 2008 and choose Microsoft Visual Studio 2008. This will open the Integrated Development Environment of VB.NET.
- Click File >> New >> Project
- 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]
- Finally press OK button.
- 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