Hotel Reservation System Vb Codes

Topics: .NET Framework, Microsoft Visual Studio, Source code Pages: 8 (1418 words) Published: June 19, 2013

Hotel Reservation System

Introduction

In this article I will explain the important procedure or function that I used in Hotel Reservation System. I wrote this article in the purpose that you will be able to use some of the useful code here in my application. May it be a payroll system, inventory system, or any application that have the same concept like filling a Listview or Combobox.

Background

This software was written in Visual Basic 6.0 and upgraded to Visual Basic .NET. I feel that it is important to update my knowledge to the newest version as possible so that I will not be left behind other developer.

This is a complete software package with free source code. I will explain in this article the useful code that can be found in Hotel Reservation System.

Using the Software

My Hotel Reservation System will help you manage a collection of data in your hotel. Moreover, you can record a reservation, check in, check out, payments, etc.

Since the purpose of this article is to teach you the importance of source code within this program, I attached here a link where you can read simple tutorial from my website at http://www.sourcecodester.com/blog/hotel-reservation-manual.html.

Using the Code

May be this code isn’t new to all of you but I do believe there are still programmer out there who needs this. I have three important code snippets to share which I used in this program – Hotel Reservation System.

Filling a ListView Control

Overview

The Windows Forms ListView control displays a list of items with icons. You can use a list view to create a user interface like the right pane of Windows Explorer. The control has four view modes: LargeIcon, SmallIcon, List, and Details. Source: Microsoft Visual Studio 2008 Documentation

In the previous paragraph, listview is used to display a list of items. So, in my application I used it to display a list of records from a table with a customize column.

To fill a listview in my program you call it like:

FillListView(lvList, GetData(sSql))

Where lvList in the first parameter is a ListView control in the FillListView procedure. The second parameter – GetData(sSql) will first call the GetData function and returns a data using OleDbDataReader.

Before we call the FillListView procedure, we will call first the procedure named FillList. In this procedure you can customize the number of columns that you want to show in a listview.

Here’s the code for FillList procedure:

Public Sub FillList()
With lvList
.Clear()

.View = View.Details
.FullRowSelect = True
.GridLines = True
.Columns.Add("Room Number", 90)
.Columns.Add("Room Type", 120)
.Columns.Add("Status", 90)

FillListView(lvList, GetData(sSql))
End With
End Sub

This procedure can be found in any form that has a listview control to list all records from a table. The only difference is that you can set the properties for every column in your listview. Of course, FillList procedure is being called at the form load event. So it will load the data from a table into the listview control before the form is displayed totally.

The following is the code for FillListView procedure:

Public Sub FillListView(ByRef lvList As ListView, ByRef myData As OleDbDataReader) Dim itmListItem As ListViewItem

Dim strValue As String

Do While myData.Read
itmListItem = New ListViewItem()
strValue = IIf(myData.IsDBNull(0), "", myData.GetValue(0)) itmListItem.Text = strValue

For shtCntr = 1 To myData.FieldCount() - 1
If myData.IsDBNull(shtCntr) Then
itmListItem.SubItems.Add("")
Else
itmListItem.SubItems.Add(myData.GetValue(shtCntr)) End If
Next shtCntr...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Hotel Reservation System Essay
  • Hotel Reservation System Essay
  • Online Hotel Reservation System Essay
  • Hotel Reservation System Essay
  • Introduction to Hotel Reservation System Essay
  • Hotel Reservation and Billing System Essay
  • HOTEL RESERVATION SYSTEM Essay
  • Hotel Reservation System Essay

Become a StudyMode Member

Sign Up - It's Free