Hello,
I'm having trouble writing to a file. I can open notepad ok, but I cannot write a string to it. What am missing here? TIA.
Imports System.IO
Module Module1
Sub Main()
Dim start_info As New ProcessStartInfo("notepad.exe")
start_info.UseShellExecute = False
start_info.ErrorDialog = False
start_info.RedirectStandardInput = True
start_info.RedirectStandardOutput = True
start_info.RedirectStandardError = True
Dim proc As New Process
proc.StartInfo = start_info
proc.Start()
Dim stdERRreader As StreamReader = proc.StandardError
Dim stdINwriter As StreamWriter = proc.StandardInput
Dim stdOUTreader As StreamReader = proc.StandardOutput
System.Threading.Thread.Sleep(500)
' send data
stdINwriter.WriteLine("TEXT FROM VB")
stdINwriter.Flush()
stdINwriter.Dispose()
' clean up
stdERRreader.Close()
stdINwriter.Close()
stdOUTreader.Close()
proc.WaitForExit()
End Sub
End Module