private void button1_Click(object sender, EventArgs e) { FillForm form = new FillForm(); form.getDept(); form.getJob(); form.btnAdd.Visible = true; form.btnUpdate.Visible = false; this.Hide(); form.Show(); }
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { DialogResult result = MessageBox.Show("Click YES to edit info press NO to print.", "Action", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.No)) { Print_Ind ind = new Print_Ind(); ind.id = this.del_id; ind.Show(); } else { dbClass db = new dbClass(); DataTable jb = db.dbSelect("SELECT description from tb_job WHERE id=" + dataGridView1.CurrentRow.Cells[9].Value.ToString()); DataTable dp = db.dbSelect("SELECT code from tb_department WHERE id=" + dataGridView1.CurrentRow.Cells[8].Value.ToString()); FillForm form = new FillForm(); form.getDept(); form.getJob(); if (this.activeTab == "Information") { form.comboBox1.Text = "Information"; form.txtLN.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); form.txtFN.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); form.txtMN.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); form.txtAdd.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); form.pickBday.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); form.txtBPlace.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); form.txtContact.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); form.cmbDept.Text = dp.Rows[0][0].ToString(); form.cmbJob.Text = jb.Rows[0][0].ToString(); form.btnUpdate.Visible = true; form.btnAdd.Visible = false; form.activeID = dataGridView1.CurrentRow.Cells[0].Value.ToString(); this.Hide(); form.Show(); } } }