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

Width of Console.WriteLine("Size of {0} ", lnSize)

P: n/a
Hi,

How would I set the width of lnSize to 6 in the statement

Console.WriteLine("Size of {0} ", lnSize);

Furthermore is there a way to combine these 3 statements into 1

Console.WriteLine();
Console.WriteLine();
Console.WriteLine();

TIA
Roy
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The \n escape character denotes a new line when in a string... so if you
replaced your 3 Console.WriteLine() calls with a single
Console.Write("\n\n\n") or even just Console.WriteLine("\n\n") you will end
up with the same output.

As for specifying the width of lnSize... in what way? The # of characters
being displayed when it is output?

Brendan
"Roy Gourgi" wrote:
Hi,

How would I set the width of lnSize to 6 in the statement

Console.WriteLine("Size of {0} ", lnSize);

Furthermore is there a way to combine these 3 statements into 1

Console.WriteLine();
Console.WriteLine();
Console.WriteLine();

TIA
Roy

Nov 17 '05 #2

P: n/a
Hi Brendan,

Thanks for the Console.WriteLine("\n\n\n").

I solved the width problem by doing this:
Console.WriteLine("Size of {0,6} ", lnSize);

Roy
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

P: n/a
Brendan Grant <gr****@NOSPAMdahat.com> wrote:
The \n escape character denotes a new line when in a string... so if you
replaced your 3 Console.WriteLine() calls with a single
Console.Write("\n\n\n") or even just Console.WriteLine("\n\n") you will end
up with the same output.


Not quite. Console.WriteLine uses the current line terminator, as
specified by Environment.NewLine. On Windows, that's "\r\n".

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.