private void button1_Click(object sender, EventArgs e) { string chuoi; chuoi = txtMaLop.Text; if (kiemtratontai()) { MessageBox.Show("Mã lớp đã tồn tại. Vui lòng nhập lại !"); } else { if (txtMaLop.Text == "") { MessageBox.Show("Bạn phải nhập mã lớp"); } //else if (chuoi.Length != 4) //{ // MessageBox.Show("Bạn phải nhập đúng 4 ký tự"); //} else { string them = "insert into DMLop values ('" + txtMaLop.Text + "','" + txtTenLop.Text + "','" + comboBox1.Text + "','" + txtDiaDiem.Text + "','" + txtThoiGianHoc.Text + "')"; SqlCommand comThem = new SqlCommand(them, con); comThem.ExecuteNonQuery(); getdata(); MessageBox.Show("Thêm mới thành công "); this.Close(); frmDMLop tg = new frmDMLop(); tg.ShowDialog(); } } }
private void độcGiảToolStripMenuItem_Click(object sender, EventArgs e) { frmDMLop lop = new frmDMLop(); lop.Show(); }