I have the following code to start the program R (even though I think that the program is not relevent for the problem here) and run a script:
Public Shared Sub RunRScript(rCodeFilePath As String, rScriptExecutablePath As String, args As String) Dim file As String = rCodeFilePath Dim result As String = String.Empty Try Dim info = New ProcessStartInfo() info.FileName = rScriptExecutablePath info.WorkingDirectory = Path.GetDirectoryName(rScriptExecutablePath) info.Arguments = rCodeFilePath & " " & args info.RedirectStandardInput = False info.RedirectStandardOutput = True info.UseShellExecute = False info.CreateNoWindow = True Using proc = New Process() proc.StartInfo = info proc.Start() result = proc.StandardOutput.ReadToEnd() proc.Close() End Using Catch ex As Exception Throw New Exception("R Script failed: " & result, ex) End Try End Sub
Problem is, if there is an error in the script I run within R I dont get an error message because the instance is invisible. I tried to make it visible with
.WindowStyle = ProcessWindowStyle.Normal
in all combinations of .UseShellExcecute and .CreateNoWindow but this is not working. Could anyone help me to can make my process visible?