public ftableQl() { InitializeComponent(); f1 = new FormSV(); f1.TopLevel = false; f1.Dock = DockStyle.Fill; this.pan.Controls.Add(f1); f2 = new FormGV(); f2.TopLevel = false; f2.Dock = DockStyle.Fill; this.pan.Controls.Add(f2); f3 = new FormDiem(); f3.TopLevel = false; f3.Dock = DockStyle.Fill; this.pan.Controls.Add(f3); f4 = new FormLTC(); f4.TopLevel = false; f4.Dock = DockStyle.Fill; this.pan.Controls.Add(f4); f5 = new Baocao(); f5.TopLevel = false; f5.Dock = DockStyle.Fill; this.pan.Controls.Add(f5); }
private void button1_Click(object sender, EventArgs e) { if (kiemtradulieu() == false) { return; } else { using (SqlConnection con = new SqlConnection(strcon)) using (SqlCommand cmd = new SqlCommand()) { con.Open(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "themmon"; cmd.Parameters.AddWithValue("@malop", txtMAM.Text); cmd.Parameters.AddWithValue("@tenmon", cbbtenmon11.SelectedValue); cmd.Parameters.AddWithValue("@tengiangvien", cbbGV.SelectedValue); cmd.Parameters.AddWithValue("@tenki", cbbkyhoc.Text); cmd.Parameters.AddWithValue("@namhoc", txtNamhoc.Text); int i = cmd.ExecuteNonQuery(); if (i > 0) { MessageBox.Show("Thông báo", "Thêm Thành Công"); FormLTC f = new FormLTC(); f.loadmon(); this.Close(); } else { MessageBox.Show("Thông báo", "Thêm Không Thành Công"); } } } }
private void themlop_FormClosed(object sender, FormClosedEventArgs e) { FormLTC f = new FormLTC(); f.loadmon(); }