| | |
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 .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog firewall folder ftp google hardcopy image images insert listview login math memory mobile ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problemwithinstallation project reports" save savedialog searchbox serial server soap sql string table tcp temp text textbox timer toolbox trim update updown upload useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





