Hello!!
OK...I got a problem here with my Visual C# .NET mail course...
I'm trying to make a program, and my book tells me exactly how to do it...and it compiles, but it doesn't run!! :(
When I run the program's EXE, it asks me what debugger I wanna use...I tried with all 3 debugging options but for some reason none worked...:(
Finally I decided to go to the program, type in the code, compile it, and then debug it...it finds this error during debug:
-----
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format.
-----
Why is it in an incorrect format and it compiled anyway??
After that message, I click on "Break" to corect the error, and it highlights the following line:
-----
Console.WriteLine("The difference between {0} and {1} is {2}", value1, value2, diff);
-----
What's wrong with that?!! also, when I commented out/deleted that line, then it highlights the next line, which has the same fonction!!
This is the full code:
-----
using System;
public class DemoVariables2
{
public static void Main()
{
int value1 = 43, value2 = 10, sum, diff, product, quotient, remainder;
product = value1 * value2;
quotient = value1 / value2;
remainder = value1 % value2;
sum = value1 + value2;
diff = value1 - value2;
Console.WriteLine("The sum of {o} and {1} is {2}", value1, value2, sum);
Console.WriteLine("The difference between {0} and {1} is {2}", value1, value2, diff);
Console.WriteLine("The product of {0} and {1} is {2}", value1, value2, product);
Console.WriteLine("{0} divided by {1} is {2}", value1, value2, quotient);
Console.WriteLine("and the remainder is {0}", remainder);
}
}
-----
What is wrong with it?!! plz help!!
Thanx!! ;)
PS: I'm running the program on a Virtual PC 2004 virtual machine...the host OS is WinXP Home, which is not fully supported by Visual Studio...:( maybe that's the cause??
El-Trucha