Results 1 to 14 of 14

Thread: [RESOLVED] Type problem

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2009
    Posts
    20

    Resolved [RESOLVED] Type problem

    Hey, I'm working on VB 2008 and I keep having the same problem when I debug. It keeps telling me "Conversion from string "blah blah" to type 'Double' is not valid." I know that its something to do with the types and possibly ByVals? I have changed around the types many times an I keep coming up with errors while debugging. I currently have no errors on the error list and I am stumped.

    What it should do first is read the input from the txtboxes on my form then calculate meal and total cost in the Processing function. then give output in the output sub. Thanks in advance.


    HTML Code:
     Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
            Inpt()
        End Sub
    
        Sub Inpt()
            Dim num1, num2, num3, num4, num5, num6, num7, calcMeal, totalCost As Double
            num1 = CDbl(org.Text)
            num2 = CDbl(dat.Text)
            num3 = CDbl(loc.Text)
            num4 = CDbl(mea.Text)
            num5 = CDbl(air.Text)
            num6 = CDbl(tax.Text)
            num7 = CDbl(tax.Text)
            Processing(num1, num2, num3, num4, calcMeal, totalCost, num5, num6, num7)
        End Sub
       
     Function Processing(ByVal num1 As Double, ByVal num2 As Double, ByVal num3 As Double, ByVal num4 As Double, ByVal calcMeal As Double, ByVal totalCost As Double, ByVal num5 As Double, ByVal num6 As Double, ByVal num7 As Double) As Double
            calcMeal = num4 * 0.5
            totalCost = num4 + num5 + num6 + num7
            Output(num1, num2, num3, num4, num5, num6, num7,totalCost, calcMeal)
        End Function
    Sub Output(ByVal num1 As Double, ByVal num2 As Double, ByVal num3 As Double, ByVal num4 As Double, ByVal num5 As Double, ByVal num6 As Double, ByVal num7 As Double, ByVal totalCost As Double, ByVal calcMeal As Double)
    
    some code omitted
    Last edited by That Guy; Oct 8th, 2009 at 07:14 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width