473,383 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Console Application

Does anyone know how to do a "Clear Screen" (i.e. cls)
with a C# Console Application?
Nov 15 '05 #1
7 3401
Not really, but you can always use

for(int i = 0; i < 80; i++)
{
Console.WriteLine("");
}

Or any number of lines really, 80 is max on XP, but you can still scroll
back further.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #2
Morten Wennevik <Mo************@hotmail.com> wrote:
Not really, but you can always use

for(int i = 0; i < 80; i++)
{
Console.WriteLine("");
}

Or any number of lines really, 80 is max on XP, but you can still scroll
back further.


What do you mean by "80 is max on XP"?

I've just created a console window which is 93 lines tall, for
instance...

There is a more advanced console library out there somewhere, but I can
never remember its name...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
I seem to remember 80 was max you could select (maybe in Windows ME).
However, since you can scroll the command window in Win XP, max seems to
be more like 300.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #4
Morten Wennevik <Mo************@hotmail.com> wrote:
I seem to remember 80 was max you could select (maybe in Windows ME).
However, since you can scroll the command window in Win XP, max seems to
be more like 300.


No - the size of the *buffer* can be set to much higher than that. I
have it set to 3000 on my box. The size of the window itself is just
limited by your display/font I believe. The limit for the buffer is
9999 (through experimentation just now; it could well be higher if you
tweak things programmatically instead of through the console window's
properties).

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #5
Is there a way to send a "cls" cmd to the Console window
instead? I'm new to C# and I don't know all the library's
I have at my disposal yet.

-----Original Message-----
Not really, but you can always use

for(int i = 0; i < 80; i++)
{
Console.WriteLine("");
}

Or any number of lines really, 80 is max on XP, but you can still scrollback further.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled.

Nov 15 '05 #6
Interesting. Haven't done much console buffering since the early days
where you scrolled back by tweaking the screen memory, but you couldn't
scroll very far until you did a full circle.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #7
Scott <an*******@discussions.microsoft.com> wrote:
Is there a way to send a "cls" cmd to the Console window
instead? I'm new to C# and I don't know all the library's
I have at my disposal yet.


Not with the plain Console. However, there are some libraries
available. See

http://www.c-sharpcorner.com/Code/20...SysConsole.asp
(Fairly basic functionality)

http://www.codeproject.com/csharp/winconsole.asp
(Looks much more fully functioned)

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Job Lot | last post by:
How can I terminate console application in Try…Catch…Finally…End Try block so that code in Finally gets executed. If I use End statement Finally does not get executed. Following is my code...
2
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message...
7
by: ajikoe | last post by:
Hello All, It is said that : Enabling the console window is easy. From Microsoft Visual Studio®, right-click on the project and choose Properties. Change the output type from Windows Application...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
3
by: inpreet | last post by:
I am trying to build a console application in C#.Net. This application is suppose to run in background without user interaction. How can I hide console to appear?
8
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
0
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is...
2
by: Jim Heavey | last post by:
Hello, I used VS 2005 to create a console application. Got the application working just fine. I then decided I would create a folder for each of my "console" applications within that project. I...
4
by: federico | last post by:
Hello, I am trying to setup a Visual Basic "Console" application for searching Outlook folders. To this end I am trying to implement a Handler for the Outlook.Application.AdvancedSearchComplete...
0
by: Stephen Thomas | last post by:
Hi there I wonder if any one has encountered this problem or can suggest what is wrong. I am trying the a procedure from the msn site but get the following message: Error 1 The type or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.