title: How to know if Process.Start() is successful?
body: <p>I've tried two different methods for starting a process.</p>
  <p><strong>The first</strong></p>
  <p>The definition is defined as parameters to the Start method:</p>
  <p><code>System.Diagnostics.Process.Start(&quot;excel&quot;, string.Format(&quot;\&quot;{0}\&quot;&quot;, ExcelFileBox.Text.ToString()));</code></p>
  <p>My thoughts:</p>
  <p>This one starts just fine, but I don't know how to get feedback from it.</p>
  <p><strong>The second</strong></p>
  <p>I started looking into <code>ProcessStartInfo</code> because I want to know if Excel started successfully or not--for instance, while it's very likely it exists on the user's machine, there's no guarantee and it would be silly for me to indicate to the user that it's started successfully when it hasn't.</p>
  <pre><code>System.Diagnostics.ProcessStartInfo startinfo = new System.Diagnostics.ProcessStartInfo
  {
      FileName = &quot;excel&quot;,
      Arguments = string.Format(&quot;\&quot;{0}\&quot;&quot;, ExcelFileBox.Text.ToString()),
      ErrorDialog = true,
      UseShellExecute = false,
      WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
  };
  
  try
  {
      System.Diagnostics.Process.Start(startinfo);
  }
  catch (Exception err)
  {
      Console.WriteLine(err.Message);
  }
  </code></pre>
  <p>My thoughts:</p>
  <p>This gives the error: &quot;The system cannot find the file specified&quot;, but it's unclear whether it means the Excel application or my file.  In any case, while I appreciate the error message ability, I shouldn't be receiving out at the moment.</p>
  <p>Thought, suggestions, ideas on how to know if this happened successfully?</p>
  <p><strong>Solved</strong></p>
  <p>I put the first way of starting a process into a try-catch and it works beautifully.</p>