private void frmProductsRecord_FormClosing(object sender, FormClosingEventArgs e) { Hide(); var frm = new frmProduct(); frm.Show(); }
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { var dr = dataGridView1.SelectedRows[0]; Hide(); var frm = new frmProduct(); frm.Show(); frm.txtProductName.Text = dr.Cells[0].Value.ToString(); frm.textBox1.Text = dr.Cells[0].Value.ToString(); frm.cmbCategory.Text = dr.Cells[1].Value.ToString(); frm.cmbCompany.Text = dr.Cells[2].Value.ToString(); frm.btnUpdate.Enabled = true; frm.btnDelete.Enabled = true; frm.btnSave.Enabled = false; frm.txtProductName.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void productToolStripMenuItem_Click(object sender, EventArgs e) { var frm = new frmProduct(); frm.Show(); }