protected void Submit_Click(object sender, EventArgs e)
{
string arg = ((Button)sender).CommandArgument;
if (arg.Equals("1"))
{
//抛出DivideByZeroException 异常
int x = System.Convert.ToInt32(TextBox1.Text);
int y = System.Convert.ToInt32(TextBox2.Text);
int z = x / y;
TextBox3.Text = z.ToString();
}
else if (arg.Equals("2"))
{
//抛出 ArgumentOfRangeException 异常
throw new ArgumentOutOfRangeException("click?!");
}
else
{
//抛出异常
throw new Exception("向上级传递异常");
}
}
//
string arg = ((Button)sender).CommandArgument;
if (arg.Equals("1"))
这两句不懂,哪位大师给指导下啊,细点讲