Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27039

keeping console visible with writing console output to text file

$
0
0
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,

Viewing all articles
Browse latest Browse all 27039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>