How to get the argument out of range Exception

Karthikanbarasan
Posted by Karthikanbarasan under C# category on | Points: 40 | Views : 2754
 private void btncheck_Click(object sender, EventArgs e)
{
int int1 = 0;
int int2 = 5;
int intresult;

try
{
throw new ArgumentOutOfRangeException();
intresult = int2 / int1;
}
catch (DivideByZeroException)
{
MessageBox.Show("Divide by zero error.", "Exception");
return;
}
catch (Exception ex)
{
MessageBox.Show("Error: ", "Exception Thrown");
}
finally
{
MessageBox.Show("Finally");
}

}
}

Comments or Responses

Login to post response