| | |
help with code.
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
i have this project. it calculates the checkout an hotel. first i need it to calculate the first subtotal which is costpernight*numberofnights. and second additionnal charges. its telephone+laundry+roomservice. thats my first step it should be done wihout any button it should appear to the user from inputing the values for each double. this what i got but its not doing the calculation right. i have to input number in all textboxes so it gives me a zero in the total. also i have an error coming up its text is not member of double. please help on this.
Public Class BlueWaterHotelCheckout
Private Total As Double
Private Subtotal As Double
Private Sub NumberOfNights_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub CostPerNight_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Total_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Dim dblCostPerNight As Double
Dim dblNumberOfNights As Double
If dblNumberOfNights.Text.Length = 0 OrElse dblCostPerNight.Text.Length = 0 Then Exit Sub ' make sure the user has entered something for both values
If Not IsNumeric(dblNumberOfNights.Text) OrElse Not IsNumeric(dblCostPerNight.Text) Then Exit Sub ' Name sure the user has entered Numbers for both values
dblNumberOfNights = CDbl(dblNumberOfNights.Text)
dblCostPerNight = CDbl(dblCostPerNight.Text)
Total = dblNumberOfNights * dblCostPerNight
TextBox3.Text = Total.ToString
End Sub
Private Sub RoomService_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub Telephone_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
End Sub
Private Sub Laundry_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
End Sub
Private Sub Subtotal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
Dim dblRoomService As Double
Dim dblTelephone As Double
Dim dblLaundry As Double
Dim Subtotal As Double
TextBox7.Text = Total
If dblRoomService.Text.Length = 0 OrElse dblTelephone.Text.Length = 0 OrElse dblLaundry.Text.Length = 0 Then Exit Sub ' make sure the user has entered something for both values
If Not IsNumeric(dblRoomService.Text) OrElse Not IsNumeric(dblTelephone.Text) OrElse dblLaundry.Text.Length = 0 Then Exit Sub ' Name sure the user has entered Numbers for both values
dblRoomService = CDbl(dblRoomService.Text)
dblTelephone = CDbl(dblTelephone.Text)
Subtotal = dblRoomService + dblTelephone + dblLaundry
End Sub
End Class
Public Class BlueWaterHotelCheckout
Private Total As Double
Private Subtotal As Double
Private Sub NumberOfNights_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub CostPerNight_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Total_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Dim dblCostPerNight As Double
Dim dblNumberOfNights As Double
If dblNumberOfNights.Text.Length = 0 OrElse dblCostPerNight.Text.Length = 0 Then Exit Sub ' make sure the user has entered something for both values
If Not IsNumeric(dblNumberOfNights.Text) OrElse Not IsNumeric(dblCostPerNight.Text) Then Exit Sub ' Name sure the user has entered Numbers for both values
dblNumberOfNights = CDbl(dblNumberOfNights.Text)
dblCostPerNight = CDbl(dblCostPerNight.Text)
Total = dblNumberOfNights * dblCostPerNight
TextBox3.Text = Total.ToString
End Sub
Private Sub RoomService_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub Telephone_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
End Sub
Private Sub Laundry_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
End Sub
Private Sub Subtotal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
Dim dblRoomService As Double
Dim dblTelephone As Double
Dim dblLaundry As Double
Dim Subtotal As Double
TextBox7.Text = Total
If dblRoomService.Text.Length = 0 OrElse dblTelephone.Text.Length = 0 OrElse dblLaundry.Text.Length = 0 Then Exit Sub ' make sure the user has entered something for both values
If Not IsNumeric(dblRoomService.Text) OrElse Not IsNumeric(dblTelephone.Text) OrElse dblLaundry.Text.Length = 0 Then Exit Sub ' Name sure the user has entered Numbers for both values
dblRoomService = CDbl(dblRoomService.Text)
dblTelephone = CDbl(dblTelephone.Text)
Subtotal = dblRoomService + dblTelephone + dblLaundry
End Sub
End Class
•
•
•
•
i have to input number in all textboxes so it gives me a zero in the total. also i have an error coming up its text is not member of double. please help on this.
other thing,in your code what the names of the input textboxes , for example is it RoomService or dblRoomService ?
Note:
It is better if use the CODE tag so your post will be easier to read
Last edited by manal; Sep 28th, 2008 at 4:56 pm.
"give only what u willing to receive "
![]() |
Similar Threads
- Code 19 Registry Error (Windows NT / 2000 / XP)
- Why won't this code work? (VB.NET)
- Need help with DirectX code (C)
- Tutorials & Code Submissions - Questions? (DaniWeb Community Feedback)
- Some Basic Code Hopefully (Help Needed) (HTML and CSS)
Other Threads in the VB.NET Forum
- Previous Thread: Help Needed to build a dynamic SQL query string in VB.NET
- Next Thread: How to retriev data frm DB in datacombo
| Thread Tools | Search this Thread |
"crystal .net 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net eclipse editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer transparency txttoxmlconverter upload useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml





