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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.