You are on page 1of 2

‫تصميم آلة حاسبة بسيطة‬

namespace WindowsFormsApplication45
{
public partial class Form1 : Form
{
double z; //‫الناتج‬
double x = 0; //‫األول العدد‬
double y = 0; //‫الثاني العدد‬
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
x = Convert.ToDouble(textBox1.Text);
y = Convert.ToDouble(textBox2.Text);
z = x - y;
textBox3.Text = z.ToString();
label4.Text = z.ToString();
MessageBox.Show("Result"+z.ToString(),"‫;)"الناتج‬

private void button2_Click(object sender, EventArgs e)


{
x = Convert.ToDouble(textBox1.Text);
y = Convert.ToDouble(textBox2.Text);
z = x + y;
textBox3.Text = z.ToString();
label4.Text = z.ToString();
MessageBox.Show("Result" + z.ToString(), "‫;)"الناتج‬
}

private void button3_Click(object sender, EventArgs e)


{
x = Convert.ToDouble(textBox1.Text);
y = Convert.ToDouble(textBox2.Text);
z = x * y;
textBox3.Text = z.ToString();
label4.Text = z.ToString();
MessageBox.Show("Result" + z.ToString(), "‫;)"الناتج‬
}

1 ‫الصفحة‬ ‫ محمد حالوة‬.‫ م‬:‫اعداد‬


private void button4_Click(object sender, EventArgs e)
{
x = Convert.ToDouble(textBox1.Text);
y = Convert.ToDouble(textBox2.Text);
z = x / y;
textBox3.Text = z.ToString();
label4.Text = z.ToString();
MessageBox.Show("Result" + z.ToString(), "‫;)"الناتج‬
}

private void button5_Click(object sender, EventArgs e)


{
DialogResult d = MessageBox.Show(" ‫" النافذة اغالق تريد هل‬,
"closed", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (d == DialogResult.Yes)
this.Close();
}
}
}

2 ‫الصفحة‬ ‫ محمد حالوة‬.‫ م‬:‫اعداد‬

You might also like