コード例 #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtMaSV.Text.Trim() == "")
            {
                MessageBox.Show("Trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtHoTen.Text.Trim() == "")
            {
                MessageBox.Show("Trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtLop.Text.Trim() == "")
            {
                MessageBox.Show("Trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtNgaySinh.Text.Trim() == "")
            {
                MessageBox.Show("Trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            if (txtDiemTk.Text.Trim() == "")
            {
                MessageBox.Show("Trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            bool GT = false;

            if (ckNam.Checked)
            {
                GT = true;
            }
            DateTime ns     = DateTime.Parse(txtNgaySinh.Text.Trim());
            double   diemtk = double.Parse(txtDiemTk.Text.Trim());

            lst = SinhVienCotroller.addInList(lst, txtMaSV.Text.Trim(), txtHoTen.Text.Trim(), ns, GT, txtLop.Text.Trim(), diemtk);
            SinhVienCotroller.GhiFile(Tenfle, lst);
            lst = SinhVienCotroller.docFile(Tenfle);
            Hienthi();
        }
コード例 #2
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     lst = SinhVienCotroller.docFile(Tenfle);
     Hienthi();
 }