Visual Basic .NET Tutorial

How to Select Startup Form

One of the common questions I received from newbie’s is on how to set a certain form to be the Startup Form.

Undoubtedly, this is a very simple question but if you are a beginner trying to learn Visual Basic you will find it very difficult to find what you are looking for because of so many options to choose from. Visual Basic is considerably one of the famous programming languages to date and its features evolve overtime, not to mention that it was a product by Microsoft.

Now let’s head on…

How to Add Windows Forms

Before we begin binding our database using Windows Form please take a look on this tutorial on how to add new windows forms to your project.

Windows Forms serves as a container for all the controls that you’d like to add. Examples are TextBox, Label, Button, CheckBox, ComboBox, etc.

When you create a new project, visual studio automatically provides you one windows forms which you can use right away, run it, or compile or project but without anything in it. It just a plain form waiting to be filled with controls.

To add a Windows Form

How to Add New Data Source

One of the coolest features of Visual Studio .NET is the ability to bind a database into Windows Forms easily using DataSet. Since VB 6.0, I’m waiting for this kind of feature to be implemented in VB.NET. I am used with MS Access before and seem that VB.NET and MS Access has no difference when it comes to DataBinding.

There are many ways to bind your data. You can use the old fashion which is hard-coding, but this is out the scope of this tutorial. Why use hard-coding if you can do it easily using drag and drop operation?

How to Create a Windows Application Project

In order to create an application in Visual Basic .NET like Payroll System, Accounting System, Enrollment System, Calculator, Point of Sale System, and Library System you need to create a project called “Windows Application”.

If you are new to programming and want to learn Visual Basic, you will probably confuse with so many option to choose in starting a Visual Basic Editor.

Please look at the screen below.

How to Attach and Detach a Database

Sometimes you want to transfer or backup your database in SQL Server. When the database is attached you cannot copy/move it to any location. All you have to do is detach it first using SQL Server Management Tools.

Another reason why I write this tutorial is to teach you so that when we finish the Library System project you will be able to switch from my own database to your own database just in case you want to differentiate each of the table.

To attach a database

1. Open SQL Server Management Tools.

2. Right click Database and click Attach.

How to Create Database Relationships

In my previous tutorial I discuss on “How to Add Table to Your Existing Database”. Now, I will explain to you on how to create database relationships between one or more tables. Relationship is very important to prevent data inconsistency in your database. For example, you cannot add record in the related table without first adding a record in the primary table.

A relationship exists when two tables are related using a primary key and a foreign key.

How to Add Table to Your Existing Database

In my previous tutorial I discuss on “How to Create Database in SQL Server 2005 Express Edition”. This time you will learn how to add a table in your “LibSys” database using SQL Server Management Studio.

Since LibSys database may contain several tables, I will only teach you to create at least one table and the rest will be done by executing a script.

How to Create Database in SQL Server 2005 Express Edition

In this tutorial you will learn how to create a Database in SQL Server 2005 Express Edition. The name of the database that we are going to create is “LibSys” which stands for Library System.

Note that I am using SQL Server Management Studio that is bundled with SQL Server 2008 R2. Regardless of version that you are using the environment still looks the same.

Please follow the steps below to create a database.