Room Charges Calculator Program using VB.Net
In our previous tutorial we focused in visual basic 6.0 by creating the point of sales, this time we are going to build a simple room charges calculator to calculate the charges of a hotel room using Microsoft Visual Basic .NET.
Things we need:
Microsoft Visual Basic .NET 2013 or later
Step 1: Open your Microsoft Visual Studio, Click New Project then in the Installed Templates go to Visual Basic and Click Windows, After that in the Name textfield which is the name of your Windows Application Project put prjHotel, in the Location textfield you can browse any directory to save your files.
Things we need:
Microsoft Visual Basic .NET 2013 or later
Step 1: Open your Microsoft Visual Studio, Click New Project then in the Installed Templates go to Visual Basic and Click Windows, After that in the Name textfield which is the name of your Windows Application Project put prjHotel, in the Location textfield you can browse any directory to save your files.
Step 2: If you don’t
have a form, add one first then put the following control objects:
(PLEASE REFER TO THE IMAGE ABOVE)
FORM PROPERTIES
StartPosition: CenterScreen
Text: Room Charge Calculator
Add FOUR LABELS:
1st LABEL PROPERTIES
Text: Rancher’s Hotel
Font: Tahoma, 26.25pt, style=Bold
Backcolor: MenuHighlight
2nd 3rd LABEL PROPERTIES
Text: Date: , Time:
Font: Microsoft Sans Serif, 9.75pt
4th 5th LABEL PROPERTIES
Text: empty
Font: Microsoft Sans Serif, 9.75pt
BorderStyle: Fixed3D
Add THREE GROUPBOX
1st 2nd 3rd GROUPBOX
Text: Room Information, Additional Charges, TOTAL CHARGES
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add TWO LABELS and TWO TEXTBOX inside the room information GROUPBOX
1st 2nd LABEL PROPERTIES
Text: No. Of Nights, Rate Per Night
Font: Microsoft Sans Serif, 8.25PT
1st 2nd TEXTBOX PROPERTIES
(Name): txtNyt, txtRate
Text: 0, 0
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add THREE LABELS and THREE TEXTBOX inside the additional charges GROUPBOX
1st 2nd 3rd LABEL PROPERTIES
Text: Room Service, Telephone, Miscellaneous
Font: Microsoft Sans Serif, 8.25PT
1st 2nd 3rd TEXTBOX PROPERTIES
(Name): txtRoom, txtTel, txtMisc
Text: 0, 0, 0
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add EIGHT LABELS inside the total charges GROUPBOX
1st 2nd 3rd 4th LABEL PROPERTIES
Text: ROOM CHARGES, ADDITIONAL CHARGES, SUB TOTAL, TAX
Font: Microsoft Sans Serif, 9.75PT
5th 6th 7th 8th LABEL PROPERTIES
StartPosition: CenterScreen
Text: Room Charge Calculator
Add FOUR LABELS:
1st LABEL PROPERTIES
Text: Rancher’s Hotel
Font: Tahoma, 26.25pt, style=Bold
Backcolor: MenuHighlight
2nd 3rd LABEL PROPERTIES
Text: Date: , Time:
Font: Microsoft Sans Serif, 9.75pt
4th 5th LABEL PROPERTIES
Text: empty
Font: Microsoft Sans Serif, 9.75pt
BorderStyle: Fixed3D
Add THREE GROUPBOX
1st 2nd 3rd GROUPBOX
Text: Room Information, Additional Charges, TOTAL CHARGES
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add TWO LABELS and TWO TEXTBOX inside the room information GROUPBOX
1st 2nd LABEL PROPERTIES
Text: No. Of Nights, Rate Per Night
Font: Microsoft Sans Serif, 8.25PT
1st 2nd TEXTBOX PROPERTIES
(Name): txtNyt, txtRate
Text: 0, 0
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add THREE LABELS and THREE TEXTBOX inside the additional charges GROUPBOX
1st 2nd 3rd LABEL PROPERTIES
Text: Room Service, Telephone, Miscellaneous
Font: Microsoft Sans Serif, 8.25PT
1st 2nd 3rd TEXTBOX PROPERTIES
(Name): txtRoom, txtTel, txtMisc
Text: 0, 0, 0
Font: Microsoft Sans Serif, 9.75PT, style=Bold
Add EIGHT LABELS inside the total charges GROUPBOX
1st 2nd 3rd 4th LABEL PROPERTIES
Text: ROOM CHARGES, ADDITIONAL CHARGES, SUB TOTAL, TAX
Font: Microsoft Sans Serif, 9.75PT
5th 6th 7th 8th LABEL PROPERTIES
Text: leave the text properties empty
(Name): lblRoom, lblCharges, lblSub, lblTax
Font: Microsoft Sans Serif, 9.75PT
9th LABEL PROPERTIES
Text: TOTAL CHARGES
Font: Microsoft Sans Serif, 12pt, style=Bold
10th LABEL PROPERTIES
Text: leave the text properties empty
(Name): lblTotal
Font: Microsoft Sans Serif, 12pt, style=Bold
Add THREE BUTTONS on the form
1st 2nd 3rd BUTTON PROPERTIES
(Name): btnCal, btnClear, btnExit
Text: CALCULATE, CLEAR, EXIT
Font: Tahoma, 9.75pt, style=Bold
Add TIMER on the form
TIMER PROPERTIES
Enabled: True
Interval: 1000
Go to your Code Editor and Paste this code.
(Name): lblRoom, lblCharges, lblSub, lblTax
Font: Microsoft Sans Serif, 9.75PT
9th LABEL PROPERTIES
Text: TOTAL CHARGES
Font: Microsoft Sans Serif, 12pt, style=Bold
10th LABEL PROPERTIES
Text: leave the text properties empty
(Name): lblTotal
Font: Microsoft Sans Serif, 12pt, style=Bold
Add THREE BUTTONS on the form
1st 2nd 3rd BUTTON PROPERTIES
(Name): btnCal, btnClear, btnExit
Text: CALCULATE, CLEAR, EXIT
Font: Tahoma, 9.75pt, style=Bold
Add TIMER on the form
TIMER PROPERTIES
Enabled: True
Interval: 1000
Go to your Code Editor and Paste this code.
Option Strict OnPublic Class Form1Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TicklblDate.Text = Now.ToString("D")lblTime.Text = Now.ToString("T")End SubPrivate Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b.ClickMe.Close()End SubPrivate Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.ClicktxtNyt.Clear()txtRate.Clear()txtRoom.Clear()txtTel.Clear()txtMisc.Clear()lblRoom.Text = NothinglblCharges.Text = ""lblSub.Text = String.EmptylblTax.Text = NothinglblTotal.Text = NothingtxtRoom.Focus()End SubPrivate Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.ClickDim nyt As Integer = 0Dim nytcharge As Decimal = 0Dim roomServ As Decimal = 0Dim Tel As Decimal = 0Dim Misc As Decimal = 0Dim TaxRate As Decimal = 0.0925DDim charges, Add, subTotal, Tax, Total As DecimalTrynyt = CInt(txtNyt.Text)nytcharge = CDec(txtRate.Text)roomServ = CDec(txtRoom.Text)Tel = CDec(txtTel.Text)Misc = CDec(txtMisc.Text)Catch ex As ExceptionMessageBox.Show("Invalid Input, Please enter numeric value")txtNyt.SelectAll()txtNyt.Focus()Exit SubEnd Trycharges = nyt * nytchargeAdd = roomServ + Misc + TelsubTotal = charges + AddTax = subTotal * TaxRateTotal = subTotal + TaxlblRoom.Text = charges.ToString("C")lblCharges.Text = Add.ToString("C")lblSub.Text = subTotal.ToString("C")lblTax.Text = Tax.ToString("C")lblTotal.Text = Total.ToString("C")End SubEnd Class
FINAL OUTPUT:
Room Charges Calculator Program using VB.Net
Reviewed by code-dev
on
10:39 PM
Rating:
Limit Calculator
ReplyDelete