首页 > 代码库 > Try Catch Finally working steps
Try Catch Finally working steps
1 private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) 2 { 3 if (comboBox1.SelectedItem != null) 4 { 5 MessageBox.Show(((DataRowView)comboBox1.SelectedItem)["Name"] + " = " + ((DataRowView)comboBox1.SelectedItem)["Value"]); 6 } 7 8 try 9 {10 int i = 1;11 int k = 0;12 13 int r = i / k;14 15 }16 catch (Exception ex)17 {18 19 throw (ex);20 //return;21 }22 23 //MessageBox.Show("After Exception continue..."); //if no finally, it is ok. with finally syntax error.24 25 finally26 {27 MessageBox.Show("After Exception Finally...");28 29 }30 31 MessageBox.Show(".....After Exception continue...");32 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。