private void btnChon_Click(object sender, EventArgs e) { try { TaoDonNhapHang f1 = (TaoDonNhapHang)Application.OpenForms["TaoDonNhapHang"]; ComboBox cbb = (ComboBox)f1.Controls["cbbSanPham"]; using (SqlConnection cnn = new SqlConnection(constr)) { using (SqlCommand cmd = cnn.CreateCommand()) { cnn.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_xemSanPhamChoCCB"; SqlDataAdapter dap = new SqlDataAdapter(cmd); DataTable data = new DataTable(); dap.Fill(data); cbb.DataSource = data; cbb.ValueMember = "iMaSanPham"; cbb.DisplayMember = "sTenSanPham"; } } cbb.SelectedValue = dataGridView1.CurrentRow.Cells["iMaSanPham"].Value.ToString(); this.Hide(); } catch (Exception ex) { } }
private void tạoĐơnNhậpHàngToolStripMenuItem_Click(object sender, EventArgs e) { TaoDonNhapHang taoDon = new TaoDonNhapHang(); taoDon.MdiParent = this; taoDon.Show(); }