close
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label2.Text = "" + (int.Parse(textBox1.Text) + int.Parse(textBox2.Text));
/* string b1,b2;
b1 = textBox1.Text;
b2 = textBox2.Text;
float numVAL = float.Parse(b1);
float num = float.Parse(b2);
label2.Text = numVAL.ToString() + num.ToString();
*/
}
private void button3_Click(object sender, EventArgs e)
{
label2.Text = "" + (int.Parse(textBox1.Text) * int.Parse(textBox2.Text));
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = "" + (int.Parse(textBox1.Text) - int.Parse(textBox2.Text));
}
private void button4_Click(object sender, EventArgs e)
{
if (double.Parse(textBox2.Text) == 0)
{
label2.Text = " ";
MessageBox.Show("除數不能為零");
return;
}
label2.Text = "" + (int.Parse(textBox1.Text) / int.Parse(textBox2.Text));
}
}
}
全站熱搜