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 7989291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:42:53+00:00 2026-06-04T12:42:53+00:00

I am converting a console application into a Windows Forms Application and a DLL.

  • 0

I am converting a console application into a Windows Forms Application and a DLL. The Windows Forms Application uses a BackgroundWorker to have the DLL perform a computationally heavy task.

Left over from the console application, the DLL is still littered with Console.WriteLine() statements. I would like to direct what used to be printed to the console into a TextBox in the Windows Form. Ideally, I would like to hook a stream from the DLL up to the text box during form initialization and be done with it. I am concerned that this might not be thread safe with the BackgroundWorker.

The best approach I have found is to change Console.WriteLine() to Trace.WriteLine() in the DLL and then follow the approach at Trace listener to write to a text box (WPF application) but I still have concerns with the BackgroundWorker and am not too keen on appending text to an existing string (there is a lot of text and IMO strings aren’t meant/optimized to have lots of text concatenated on them).

What is the best way to print the old console output to the text box that will be safe with a BackgroundWorker?

  • 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-06-04T12:42:54+00:00Added an answer on June 4, 2026 at 12:42 pm

    The following blog post may be what you’re looking for:

    http://saezndaree.wordpress.com/2009/03/29/how-to-redirect-the-consoles-output-to-a-textbox-in-c/

    I think it describes exactly what you’re asking for. Basically it uses Console.SetOut to redirect the console output to a stream writer of your own. Read the comments below the post for some additional information on handling thread issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently converting what was a Console Application into a Windows Form application.
I'm converting a console application to one that uses Swing. At the moment I
I am writing a simple console application in Objective-C but I have heard that
I am developing a windows service application and I'm running into a problem concerning
Using following console application i am converting each string to uppercase letters. But string
I'm looking for different ways with strengths/weaknesses for converting a console application we are
I have designed a C# console application to merge and split huge files (about
I'm trying to integrate a SNMP agent into a Windows application written in native
For converting a integer into an enum (out of a json file), I declared
I'm converting a large, multi-project CVS repository into Subversion using cvs2svn. It's working really

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.