+ Reply to Thread
Results 1 to 6 of 6

Thread: C# Console Application

  1. #1
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    C# Console Application

    i know that in a c# console application, you can write text to the screen with:
    Code:
    Console.WriteLine("text...");
    but is there some way to then modify the text i have already writen?

    i am writing a program that processes information in batches and want to have a running total on the screen of many loops have been completed, but don't want to write a new line each time (because that just looks stupid).

    please help.

  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: C# Console Application

    Console.Clear();

    Then re-write the entire screen's data.



    Clumsy yes but it should work. You might wanna make a method called ScreenWrite or something similar that writes the entire console's data, so it is easier to modify and print the data that's needed.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: C# Console Application

    i thought of doing something like this, but wanted to know if there was a better way.

    btw, i am still open to another suggestion if there is a better way...
    Last edited by kbjradmin; 04-18-2009 at 07:10 PM.

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: C# Console Application

    You can use Console.CursorLeft to get & set the column of the cursor. There's also Console.SetCursorPosition(). Printing a carriage return w/o a newline might also work. If you really want to get fancy, you can use a Curses binding.

  5. #5
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: C# Console Application

    thank you, misson, Console.SetCursorPosition() worked perfectly. i would have given rep, but i've already given you some recently, so it won't let me.
    Last edited by kbjradmin; 04-19-2009 at 03:46 PM.

  6. #6
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: C# Console Application

    Quote Originally Posted by kbjradmin View Post
    thank you, misson, Console.SetCursorPosition() worked perfectly. i would have given rep, but i've already given you some recently, so it won't let me.
    I repped him for both of us; I wish I had known about that 2 console apps ago.


    Freakin' wrote a whole method to clear the screen and redraw everything, couldve just used that to rewrite what I needed.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

+ Reply to Thread

Similar Threads

  1. 300 short cuts of Windows XP
    By goodone in forum Computers & Technology
    Replies: 34
    Last Post: 11-29-2011, 12:12 AM
  2. Console Wars in Review
    By Sohail in forum Gamer's Lounge
    Replies: 2
    Last Post: 09-19-2008, 09:44 PM
  3. New Sega console to challenge PS3 and Wii?
    By beandab in forum Gamer's Lounge
    Replies: 10
    Last Post: 07-12-2008, 06:33 PM
  4. What is the Best VG console?
    By Mikek in forum Gamer's Lounge
    Replies: 13
    Last Post: 08-10-2005, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers