private void Add_Supplier_Click(object sender, EventArgs e) { Control ctls = this.Parent; Supplier_Details sd = new Supplier_Details(); ctls.Controls.Clear(); ctls.Controls.Add(sd); }
private void btn_edit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { foreach (DataGridViewRow dr in dataGridView1.SelectedRows) { sup_id = Convert.ToInt32(dr.Cells["col_sup_id"].Value); } Control ctls = this.Parent; Supplier_Details sd = new Supplier_Details(); ctls.Controls.Clear(); ctls.Controls.Add(sd); // ucp.Show(); } else { MessageBox.Show("Please Select A Row", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }