Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6228787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:26:56+00:00 2026-05-24T09:26:56+00:00

I have some screens making some data queries that might take a long time.

  • 0

I have some screens making some data queries that might take a long time. My db layer already puts the query strings to the console (I can see them in the output window when debugging). I just want to have a window the user can open to see the same thing if they grow impatient.

Any suggestions on a quick way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:26:57+00:00Added an answer on May 24, 2026 at 9:26 am

    If you redirect the Console.Out to an instance of a StringWriter, you can then get the text that has been written to the console:

    StringWriter writer = new StringWriter();
    Console.SetOut(writer);
    StringBuilder consoleOut = writer.GetStringBuilder();
    string text = consoleOut.ToString();
    

    If you do this within a new Form, you can then poll at an interval to get the text that has been written to the console so far and put its value into a TextBox. A crude example:

    public MyForm()
    {
        InitializeComponent();
    
        StringWriter writer = new StringWriter();
        Console.SetOut(writer);
    
        Timer timer = new Timer();
        timer.Tick += (o, s) => textBox.Text = writer.GetStringBuilder().ToString();
        timer.Interval = 500;
        timer.Start();
    }
    

    A few things to be careful with:

    • StringWriter is disposable, so technically you need to dispose of it when done (although in reality its Dispose() method does nothing so not really a big issue).
    • StringWriter keeps an internal StringBuilder containing all of the text written to it so far. This will only ever get bigger over time, so the longer your application runs, the more memory it will consume. You could put some checks in to clear it out periodically when it reaches a certain size.
    • If you make the interval too small, you will be constantly using CPU.
    • Make sure to set Console.Out back to its original value when you close your form, otherwise you will not be able to print messages to the console again.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some input data that sometimes appears with &nbsp characters on the end.
I have a jqgrid in a modal popup that has data dependent on some
I have a data frame with some very long comments columns. When I have
I have some UI in VB 2005 that looks great in XP Style, but
I have a page that is making an XML POST-Request to an URL on
I need some advice about the design on my app. I have several screens
I'm making a WPF application that is comprised of Screens (Presenter + View). I
Newbie Objective C/Cocoa question: I have an application with some data entry fields and
I'm making a webapp. Some of the files that it loads contain pure, static
I'm trying to implement a chart that can handle real time data, which comes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.