Results 1 to 7 of 7

Thread: [RESOLVED] keeping console visible with writing console output to text file

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2012
    Posts
    14

    [RESOLVED] keeping console visible with writing console output to text file

    Hello,

    I have the following problem with which I would like some help,

    I have a program running which normally outputs to the console. I would now like to save this output to a text file. I have tried the following. I now have the text file created and the output written to it. However I no longer can see the console. Is it possible to make it visible or alternatively would it be possible to display the console output into a textbox (I have had no luck with that) while it is writing to the text file?

    Dim fs As New FileStream("C:\Test.txt", FileMode.Create) 'see comment
    Dim tmp As TextWriter = Console.Out 'see comment
    Dim sw As New StreamWriter(fs) 'see comment



    While (xlStatus <> XLClass.XLstatus.XL_ERR_QUEUE_IS_EMPTY)

    Console.SetOut(sw) 'see comment

    ' if receiveing succeed....
    If (xlStatus = XLClass.XLstatus.XL_SUCCESS) Then

    ' ...print rx data to console
    CANDemo_RxChannel.xlPrintRx(receivedEvent)
    Console.SetOut(tmp) 'see comment
    End If

    End While

    'Comment: These are the bit I’ve added to this section of the original program to have it write to text file but the console is no longer visible

    I would be grateful if I could get any help with this problem.

    thanks,
    Last edited by vb_enthusiast; May 15th, 2013 at 12:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width