How to show the console contents in a Window Form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mina2040
    New Member
    • Dec 2008
    • 6

    How to show the console contents in a Window Form?

    Does anybody has any idea how to listen to the console and show its contents in a Windows Form Application?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Whos console, yours or another processes?

    Comment

    • mina2040
      New Member
      • Dec 2008
      • 6

      #3
      My console!! in the same project.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Hmm well, everything outputed to your console is put there by you youself in code, so I would say just change your console.writeli ne's to myTextbox.Appen dText()s ?

        Comment

        • nukefusion
          Recognized Expert New Member
          • Mar 2008
          • 221

          #5
          You could also attach a Listener object to intercept output.
          That would save you trawling through your code and adding additional lines to output the data somewhere else.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by nukefusion
            You could also attach a Listener object to intercept output.
            That would save you trawling through your code and adding additional lines to output the data somewhere else.
            Seems a bit over kill because it's his own code that is generating the output in the first place....I would recommend trying Plater's suggestion first before attempting the Listener Object implementation.

            Comment

            • nukefusion
              Recognized Expert New Member
              • Mar 2008
              • 221

              #7
              Originally posted by Frinavale
              Seems a bit over kill because it's his own code that is generating the output in the first place....I would recommend trying Plater's suggestion first before attempting the Listener Object implementation.
              Agreed, if it's only a few lines scattered around a few classes then Platers suggestion would work fine and would definitely be the way to go.

              I was thinking more in terms of if it's hundreds of lines of code all over the place. In those circumstances a listener would be much quicker to implement than trawling through existing code - it's fairly simple to setup requiring only a handful of lines of code and only needs to be plugged in once. It's also got the added benefit that once it's set up, it's there. You don't need to remember to add those additional lines in the future either, making it easier to maintain.
              I guess it really depends on what you want to do with it long term.

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                edit: oops wrong thread

                Comment

                Working...