title: Catch System.ArgumentException The URL cannot be empty
body: <p>I'm trying to the catch <code>System.ArgumentException</code> "The URL cannot be empty." and display a message:</p>
  
  <pre><code>catch (System.ArgumentException errormsg)
  {
      string errorVar = Convert.ToString(errormsg);
      if (errorVar == "System.ArgumentException: The URL cannot be empty.")
      {
          MessageBox.Show("The URL / Filename cannot be empty. Please check and try again");
      }
      else
      {
          MessageBox.Show("There is no message for this error:- " + errorVar);
      }
  }
  </code></pre>
  
  <p>At the moment, it keeps running the "Else" scenario with the message box of :</p>
  
  <p><a href="https://i.stack.imgur.com/9tm4s.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9tm4s.gif" alt="enter image description here"></a></p>
  
  <p>NB: line 153 =                 <code>doc.Load(openFileDialog1.FileName);</code>  </p>
  
  <p>Could someone please help me get it running the "if" instead of the "else" ?</p>