Thứ Bảy, 25 tháng 4, 2015

chuong trinh thiet ke from dơn gian

//from1,nhập tên đăn nhập đúng ở from1 ,chương trình xuất ra from2




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

        private void Form1_Load(object sender, EventArgs e)
        {
            Form frm = new Form2();
            frm.ShowDialog();
        }
    }
}

//from2
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 vidu3
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
if ((this.txtTen.Text=="saocungduoc")&&(this.txtPass.Text=="123456"))
this.Close(); 
else
{
MessageBox.Show("Không đúng tên người dùng / mật khẩu !!!","Thông báo");
this.txtTen.Focus();
}
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult traloi;
            traloi = MessageBox.Show("Chắc không?", "Trả lời",MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (traloi == DialogResult.OK)
                Application.Exit();
        }
    }
}

Không có nhận xét nào:

Đăng nhận xét