473,787 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Console Application

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

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

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.WriteLi ne("");
}

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.co m>
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 programmaticall y instead of through the console window's
properties).

--
Jon Skeet - <sk***@pobox.co m>
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.WriteLi ne("");
}

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*******@disc ussions.microso ft.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.co m>
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
2329
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 written in Console Application. Module Module1 Sub Main() Call Testing()
2
10984
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 would be sent to the host GUI application via PostMessage to WM_USER + X. The GUI application would then execute a function to retrieve data from the DLL. With this new setup, I have a console application as the host. I retrieved the handle...
7
4392
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 to Console Application. I use C# Standard Edition and I can't change the output type files from Windows Application to Console Application. I can' t find how tho change it although I follow this procedure: Menu Project -> Properties -> Common...
5
11258
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 to avoid the overhead of writing to the console if it is not visible, eg I am running inside a WinForm application. thanks
3
15031
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
18658
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 available in the same form for users to enter commands and display outputs if some prefer to use character based user interface. I would like to implement the user interface in vb .net. Now I have menus and toolbars ready, but do not now how to get a...
0
1608
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 that when I ran it and looked at memory usage (in Windows task manager) it looked as if there was a very slow leak. To isolate the issue:
2
525
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 created a new folder and placed the working application under tht folder (This included the .config file, the driver .cs (void main) and the class which is called by the driver class which does all of the work). I created a new folder for a new...
4
5696
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 Event. The problem I have is that the application finishes and exits before the AdvanceSearch, so the Event Handler in never called. If I delay the end of the application, for example, by having message box right after the call to AdvancedSearch,...
0
2065
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 namespace name 'LiveSearch' does not exist in the namespace 'ConsoleSampleWebSearch' (are you missing an assembly reference?) C:\Documents and Settings\Compaq\Local Settings\Application Data\Temporary Projects\ConsoleSampleWebSearch\Program.cs 13 30...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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
10363
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...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
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
5398
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...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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

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.