您的位置:首页 > 编程语言 > C#

C#旅途之 窗口化的a+b

2016-03-23 16:51 525 查看
流程:

1.创建三个textbox来储存输出,输出信息;

2.使用Lable来放不可被修改的图标,比如:加号和等号;

3.创建一个button按钮,来触发加法;

4.输出是convert.Tostring 来搞定的;

PS:本来感觉很难,理解一下就好了;

代码:

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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int a, b, c;
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToInt32(textBox2.Text);
textBox3.Text = Convert.ToString(a + b);
}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: