Đề: Xây Dựng chương trình nhập vào 2 số nguyên dương và xuất ra tổng 2 số đó với giao diện sau
*Bài Tập C# Console
*Bài Tập Windows Forms
Code xử lý:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int so1f, so2f,so3f;
so1f = Convert.ToInt32(so1.Text);
so2f = Convert.ToInt32(so2.Text);
so3f = so1f + so2f;
tong.Text = ""+so3f;
}
private void button2_Click(object sender, EventArgs e)
{
so1.Text = "";
so2.Text = "";
tong.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
DialogResult thongbao;
thongbao = (MessageBox.Show("bạn có muốn thoát", "chú ý", MessageBoxButtons.YesNo, MessageBoxIcon.Warning));
if (thongbao == DialogResult.Yes)
Application.Exit();
}
}
}
0 comments:
Post a Comment