private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { DataGridViewRow dr = dataGridView1.SelectedRows[0]; this.Hide(); frmEvents frm = new frmEvents(); // or simply use column name instead of index //dr.Cells["id"].Value.ToString(); frm.Show(); frm.txtEventID.Text = dr.Cells[0].Value.ToString(); frm.txtEventName.Text = dr.Cells[1].Value.ToString(); frm.dtpStartingDate.Text = dr.Cells[2].Value.ToString(); frm.dtpStartingTime.Text = dr.Cells[3].Value.ToString(); frm.dtpEndingDate.Text = dr.Cells[4].Value.ToString(); frm.dtpEndingTime.Text = dr.Cells[5].Value.ToString(); frm.textBox1.Text = dr.Cells[6].Value.ToString(); frm.txtActivities.Text = dr.Cells[7].Value.ToString(); frm.lblUser.Text = lblUser.Text; frm.lblUserType.Text = lblUserType.Text; frm.lblUser.Text = lblUser.Text; frm.btnDelete.Enabled = true; frm.btnUpdate_record.Enabled = true; frm.txtEventName.Focus(); frm.btnPrint.Enabled = true; frm.btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void eventToolStripMenuItem3_Click(object sender, EventArgs e) { this.Hide(); frmEvents frm = new frmEvents(); frm.lblUserType.Text = UserType.Text; frm.lblUser.Text = User.Text; frm.Show(); }
private void frmEventRecords_FormClosing(object sender, FormClosingEventArgs e) { this.Hide(); frmEvents frm = new frmEvents(); frm.lblUserType.Text = lblUserType.Text; frm.lblUser.Text = lblUser.Text; frm.Show(); }