Adblock breaks this site

Spot the error lol

Discussion in 'Programming General' started by matt_sells, Jan 30, 2012.

  1. matt_sells

    matt_sells Member

    Joined:
    Nov 28, 2011
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0
    Spot the error lol

    Code:
    Label17.Text = Label1.Text + Label2.Text
            Label10.Text = ((Val(Label1.Text) / Val(Label17.Text)) * Val(100))
    actually just spent 10 minutes totally confused as to why it wasn't doing what it should lol
     
  2. Covey

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816
    Spot the error lol

    val(100) or no val() around label1 & label2.
    You also leave yourself open to errors if label7 = 0.
     
  3. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Spot the error lol

    I'm guessing the first line just concatenates strings rather than getting the sum you were probably intending.
     
  4. matt_sells

    matt_sells Member

    Joined:
    Nov 28, 2011
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0
    Spot the error lol

    yea literally spent 10 minutes figuring that out, I just couldn't see it lol
     
< C program problem | AutoTyper >


 
 
Adblock breaks this site