title: Simple software testing tool - VB.NET
body: <p>ok, please do no laugh at this :x<br>
  i'm trying to create a simple software testing tool in VB.NET<br>
  <em>i created a simple C program PROG.EXE which scans a number and prints the OUTPUT, and started building my tester, it should execute <strong>PROG.EXE  output.txt</strong>, so PROG.EXE takes input from input.txt and prints the output to output.txt</em><br>
  but i failed, at first i tried Process.start then shell but nothing worked !<br>
  so i did this trick, the VB.NET codes generate a batch file with this codes <strong>PROG.EXE  output.txt</strong>, but again i failed, though the VB.NET created the batch file and executes too, but nothing happened ! but when i manually run the batch file i got success !<br>
  i tried executing the batchfile then sendkey the VBCR/LF/CRLF still nothing happens !<br>
  whats wrong ?</p>
  
  <hr>
  
  <p><em>My VB.NET Code, i am using Visual Studio 2010 Professional</em>  </p>
  
  <pre><code>Option Explicit On  
  Option Strict On  
  Public Class Form1  
   Dim strFileName As String
  
   Private Sub btnRun_Click() Handles btnRun.Click  
    Dim strOutput As String  
    Using P As New Process()  
     P.StartInfo.FileName = strFileName  
     P.StartInfo.Arguments = txtInput.Text  
     P.StartInfo.RedirectStandardOutput = True  
     P.StartInfo.UseShellExecute = False  
    P.StartInfo.WindowStyle = ProcessWindowStyle.Hidden  ' will this hide the console ?
     P.Start()  
     Using SR = P.StandardOutput  
      strOutput = SR.ReadToEnd()  
     End Using  
    End Using  
    txtOutput.Text = strOutput  
   End Sub
  
   Private Sub btnTarget_Click() Handles btnTarget.Click  
    dlgFile.ShowDialog()  
    strFileName = dlgFile.FileName  
    lblFileName.Text = strFileName  
   End Sub  
  End Class  
  </code></pre>
  
  <p>And this is my C code</p>
  
  <pre><code>#include&lt;stdio.h&gt;  
  #include&lt;conio.h&gt;
  
  void main()
  {
   int x;
   scanf("%d",&amp;x);
   printf("%d",(x*x));
  }
  </code></pre>
  
  <p>my program runs perfectly when i run <strong>prog.exe &lt;input.txt> output.txt</strong> in console</p>