By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,349 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

P: n/a
.YC
Hi, I was trying on the following code n I got an exception. Can anyone tell
me whats wrong?
using System;

namespace Module_2

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Write

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

Console.WriteLine("Exponential formatting - {0:E}", 888.8);

Console.WriteLine("Fixed-point formatting - {F3}", 888.8888);

Console.WriteLine("General formatting - {0:G}", 88.888); //I got
stuck here..

Console.WriteLine("Number formatting - {0:N}", 8888888.8);

Console.WriteLine("Hexadecimal formatting - {0:x4}", 88);

Console.ReadLine();

}

}

}

The message:
An unhandled exception of type 'System.FormatException' occurred in
mscorlib.dll

Additional information: Input string was not in a correct format.

TQ
YC

Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
.YC
Ooo ic
TQ
:P

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
.YC wrote:
|| Hi, I was trying on the following code n I got an exception. Can
|| anyone tell me whats wrong?

|| static void Main(string[] args)
||
|| Console.WriteLine("Exponential formatting - {0:E}", 888.8);
||
|| Console.WriteLine("Fixed-point formatting - {F3}", 888.8888);

Should be:
Console.WriteLine("Fixed-point formatting - {0:F3}", 888.8888);

Willy.

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more C# / C Sharp Questions on Bytes