Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

help on error message

Posted on 2008-10-02
4
Medium Priority
?
187 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:elrayiss
  • 3
4 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 1600 total points
ID: 22628330
you missed a value at the end of the first line:

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
 

should read
If TextBox4.Text.Length = 0 AndAlso TextBox5.Text.Length = 0 AndAlso TextBox6.Text.Length = 0 Then Exit Sub
If Not IsNumeric(TextBox4.Text) OrElse Not IsNumeric(TextBox5.Text) AndAlso TextBox6.Text.Length Then Exit Sub
 
notice the = 0 after TextBox6.Text.Length
 

Open in new window

0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 22628347
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

0
 

Author Closing Comment

by:elrayiss
ID: 31502485
excellent thank you
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 22645844
Glad to be of assistance.

AW
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question