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