How to handle Format Exception in C#
<p>Hi I'm trying to make simple calculator as i'm new to C# and not familiar with, anyway when i try to handle format exception by try catch i didn't work when I enter a value rather than number it always throw an exception without executing the catch block</p>

<pre><code>try
{
  Val1 = double.Parse(opr1.Text);
  Val2 = double.Parse(opr2.Text);
  double sum = Val1 + Val2;
  label1.Text = sum.ToString();
}
catch(Exception ex //or FormatException) 
{
  label1.Text = "Please enter the proper data type";
}
</code></pre>

<p>always gives an error when trying to convert the wrong value without executing the catch block</p>