Colt

Colt

  • NA
  • 6
  • 2.4k

Crazy Syntax Error

May 19 2013 6:13 PM
this is the error that i am getting:

FormatException was unhandled
Input string was not in a correct format.

i am getting this from this line of code:

double b = double.Parse(Counter.Text) - .01;

so i rewrote it as this:

string b = Convert.ToString((Convert.ToDouble(Counter.Text)) - .01);

and got the same error

i am using this code like this:

private void Timer()
        {
            //Starts a conditional loop
            //Conditions are that 'TimeInterval' is set to 1
            if (Convert.ToBoolean(TimeInterval = 1))
            {
                //Creates 'b' and sets it to what the current text in 'Counter'
                //and takes .01 from it
                string b = Convert.ToString((Convert.ToDouble(Counter.Text)) - .01);
                //Sets the text displayed in the Points to 'b'
                Counter.Text = Convert.ToString(b);
            }
        }

this is for a small game in my programming class and is the last bit of code i need
any help solving this will be apreciated

Answers (2)