title: c# detect an open web browser
body: <p>I am writing a program that searches certain web pages before closing.  I would like my program to open a NEW WINDOW using the DEFAULT BROWSER.  I can have my program focus the newest window instance, and then it will close that instance once it is done.</p>
  
  <p>I have been staring at WebBrowser.Navigate and System.Diagnostics.Process.Start(target) all day but I cant find the sweet spot with either of them.</p>
  
  <p>WebBrowser.Navigate always opens IE, I have been looking in the API and can't find a way to change the program used.  Does anyone else see something that I dont?  Is there a way to change the application used?</p>
  
  <p>System.Diagnostics.Process.Start(target) opens in a new tab, not a new window like navigate does.  However none of the overloaded functions from the API have a way of saying "create a new instance or window".  </p>
  
  <p>this is my issue, they both have pieces that I want, but I cant figure out how to get the pieces I need for either one.  </p>
  
  <p>I would be extremely grateful for you help.  I have been looking for hours now and I can seem to come to a solution.</p>
  
  <p>code sample for Jester:</p>
  
  <pre><code>            Process defaultbrowser = new Process();
  
  
              defaultbrowser.StartInfo.CreateNoWindow = true;
              defaultbrowser = Process.Start(target);       
  
              int waitTime = Convert.ToInt32(numericUpDown2.Value);
             System.Threading.Thread.Sleep(waitTime*1000);
  
             defaultbrowser.CloseMainWindow();
             defaultbrowser.Close();
  </code></pre>
  
  <p>furthermore my Close() function is causing a runtime error that says;</p>
  
  <blockquote>
    <p>System.NullReferenceException: Object reference not set to an instance
    of an object.</p>
  </blockquote>
  
  <p>which seems silly because too me the above code makes me think that my defaultbrowser is an instance of a process, which is then supposed to be able to call the non-static function "close()".</p>