Android Question Invalid double ""

Discussion in 'Android Questions' started by Yves Mazzon, Apr 27, 2015.

  1. Yves Mazzon

    Yves Mazzon Member Licensed User

    Hello group,
    I battling with an error "invalid double "" ". In my code I'm collecting 3 numerical values in 3 labels. The values in the labels are text type. when I compute them in a variable I get a message saying " An error has occurred in Invalid double: "" Then it ask me if I want to continue? If I say yes and fill the 3 boxes with a numerical value the error goes away
    Obviously if the label string is empty it does not compute. How can I get around that as my program will have to do a lot of math. see below the routine. Many thanks in advance


    'seconds computation

    hour = lblData5.Text
    minute = lblData6.Text
    second = lblData7.Text
    totalTimeSec = (hour *3600) + (minute*60) + second
    Display_results.Text = totalTimeSec
  2. eurojam

    eurojam Well-Known Member Licensed User

    not the seconds computation is the problem, the problem is what event starts your seconds computation. In other words you have to check if there are values which can be converted to double like:
    If IsNumber(lblData5.Text) and IsNumber(lblData6.Text) and IsNumber(lblData7.Text) then
      hour = lblData5.Text
      minute = lblData6.Text
      second = lblData7.Text
      totalTimeSec = (hour *
    3600) + (minute*60) + second
      Display_results.Text = totalTimeSec 
    end if
    DonManfred and mangojack like this.
  3. Yves Mazzon

    Yves Mazzon Member Licensed User

    Many thanks Stefan, that did the trick.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice