try-catch中的message提示
来源:互联网 发布:网络店小二 编辑:程序博客网 时间:2024/06/05 11:45
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.TextLength == 0 || textBox2.TextLength == 0) { MessageBox.Show("请输入数:"); return; } try { double x = double.Parse(textBox1.Text); double y = double.Parse(textBox2.Text); double xy = x + y; textBox3.Text = xy.ToString(); } catch(Exception ex) { MessageBox.Show(ex.Message);//自动显示错误的原因 } } }}
运行结果:
阅读全文
0 0
- try-catch中的message提示
- C++中的try catch
- js中的try catch
- C++中的try..catch
- php中的try{}catch(){}
- js中的try-catch
- js 中的 try/catch
- JS中的try catch
- jscript 中的 try{}catch(){}
- try...catch...finally中的return
- VC中的try,catch问题
- [STAX] Script中的try/catch
- Java中的try catch finally
- C++中的try{} catch(…)
- C++中的try catch throw
- try...catch...finally中的return
- java中的try catch finally
- Java 中的try-catch-finally
- 左传 —— 春秋左氏传
- 解决 hybird 应用中重复获取 WebView,导致页面元素无法识别的问题
- Python学习练习4----Functions(函数)
- python使用jdango创建web项目完整步骤
- Java 的特点----JVM(1)
- try-catch中的message提示
- 顺序表操作
- RELU 激活函数及其他相关的函数
- 深度学习类文章收集
- 快速傅里叶算法实现
- 记一次开发的接口测试.
- RMQ算法(ST实现在线查询)
- Financial Management
- pb用法