Link to home
Start Free TrialLog in
Avatar of elrayiss
elrayiss

asked on

help on error message

i got this code that when i get to put a value in room service the whole thing stop working and tell me Conversion from string "" to type 'Double' is not valid."}. my code is suppose to calculate subtotal which is telephoneChg + RoomService + Laundry my code is the follow please help
If TextBox4.Text.Length = 0 AndAlso TextBox5.Text.Length = 0 AndAlso TextBox6.Text.Length Then Exit Sub
If Not IsNumeric(TextBox4.Text) OrElse Not IsNumeric(TextBox5.Text) AndAlso TextBox6.Text.Length Then Exit Sub
 
        dblRoomService = CDbl(TextBox5.Text)
        dblTelephone = CDbl(TextBox4.Text)
        dblLaundry = CDbl(TextBox6.Text)
        Subtotal = dblRoomService + dblTelephone + dblLaundry
        TextBox7.Text = CStr(Subtotal)
        TextBox7.Text = Format(Subtotal, "$#,##0.00")
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also, the second line should read:
If Not IsNumeric(TextBox4.Text) OrElse Not IsNumeric(TextBox5.Text) OrElse Not IsNumeric(TextBox6.Text) Then Exit Sub
 

Open in new window

Avatar of elrayiss
elrayiss

ASKER

excellent thank you
Glad to be of assistance.

AW