473,670 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi,

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

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

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

Console.WriteLi ne();
Console.WriteLi ne();
Console.WriteLi ne();

TIA
Roy
Nov 17 '05 #1
3 3774
The \n escape character denotes a new line when in a string... so if you
replaced your 3 Console.WriteLi ne() calls with a single
Console.Write(" \n\n\n") or even just Console.WriteLi ne("\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.WriteLi ne("Size of {0} ", lnSize);

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

Console.WriteLi ne();
Console.WriteLi ne();
Console.WriteLi ne();

TIA
Roy

Nov 17 '05 #2
Hi Brendan,

Thanks for the Console.WriteLi ne("\n\n\n").

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

Roy
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
Brendan Grant <gr****@NOSPAMd ahat.com> wrote:
The \n escape character denotes a new line when in a string... so if you
replaced your 3 Console.WriteLi ne() calls with a single
Console.Write(" \n\n\n") or even just Console.WriteLi ne("\n\n") you will end
up with the same output.


Not quite. Console.WriteLi ne uses the current line terminator, as
specified by Environment.New Line. On Windows, that's "\r\n".

--
Jon Skeet - <sk***@pobox.co m>
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
122125
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width: 123px; height: 456px;" alt="">
4
30356
by: Kerwin Cabrera | last post by:
I am writing a console application and I would like to put a "Press any key..." message once the program is done executing. Currently, when it executes it returns to the prompt. I have tried console.read and console.readline but they both require an <Enter> key to be hit. Any suggestions Thanks -KC
2
1487
by: ÕÔÁ¢ÈÊ | last post by:
I have a large number of Console.WriteLine() function to display debug information debug mode. Now,I want to save them to a text or display them in a text box.How Can I do it?? thank you for your replay!
1
319
by: Grey | last post by:
Can I use System.Console.WriteLine('fasfasdf') in ASP.NET development as I need to print out some message in the console during the debug stage..
20
4307
by: AndyZa | last post by:
Is the following html valid? <p><hr width="50%"></p> Or would the following be more "technically correct"? <p> <hr width="50%"> Do I require the closing </p> tag?
3
5309
by: Phil Endecott | last post by:
Dear Experts, It looks as if the HTML4 spec does not define a meaning for empty height and width attributes in an IMG element. Moz seems to ignore them, while IE7 sets the dimension to 1 pixel (or something like that). I have a vague recollection that "" did have a defined meaning at some point in the past, but maybe I am mis-remembering. Can anyone confirm? I have encountered this in some third-party PHP code that I'm using on
3
1577
by: Tom | last post by:
Can someone please explain the non-working aspect of binding to Width? See code below. Thanks !! -- Tom =================================================== using System; using System.Collections.Generic;
3
6539
by: Curious | last post by:
I''ve created a simple Console Application in C#.NET (.NET 2.0), and I have the following code: Console.WriteLine("Now let us begin!"); However, the string, "Now let us begin!", never shows up in the "View"- FYI, the text in the "View"->"Output" window is below instead: 'IO.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL
2
3333
by: Tenaious | last post by:
Hi, Sorry about such a ridicules question, but I have no clue what’s going on. I'm Using Visual Studio 08, programming in C++. I have a Serial Port created with: static System::IO::Ports::SerialPort^ SP1= (gcnew System::IO::Ports::SerialPort()); SP1->PortName="COM1";
0
8388
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.