help with code.

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 1
Reputation: elrayiss is an unknown quantity at this point 
Solved Threads: 0
elrayiss elrayiss is offline Offline
Newbie Poster

help with code.

 
0
  #1
Sep 28th, 2008
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
Attached Files
File Type: pdf proj2.pdf (277.2 KB, 1 views)
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 121
Reputation: manal is an unknown quantity at this point 
Solved Threads: 17
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: help with code.

 
0
  #2
Sep 28th, 2008
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.
sorry but I don't understand the problem , you mean the total is always zero?
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 "
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC