private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     try
     {
         DataGridViewRow dr = dataGridView1.SelectedRows[0];
         this.Hide();
         frmSubectEntry frm = new frmSubectEntry();
         // or simply use column name instead of index
         //dr.Cells["id"].Value.ToString();
         frm.Show();
         frm.SubjectCode.Text = dr.Cells[0].Value.ToString();
         frm.TextBox1.Text    = dr.Cells[0].Value.ToString();
         frm.SubjectName.Text = dr.Cells[1].Value.ToString();
         frm.cmbClass.Text    = dr.Cells[2].Value.ToString();
         // frm.txtClassID.Text = dr.Cells[3].Value.ToString();
         frm.lblUser.Text          = lblUser.Text;
         frm.lblUserType.Text      = lblUserType.Text;
         frm.SubjectCode.Enabled   = false;
         frm.Delete.Enabled        = true;
         frm.Update_record.Enabled = true;
         frm.btnSave.Enabled       = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void subjectEntryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmSubectEntry frm = new frmSubectEntry();

            frm.lblUserType.Text = UserType.Text; //Main menu k User Type or User Set kiye
            frm.lblUser.Text     = User.Text;
            frm.Show();
        }
        private void frmSubjectRecords_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            frmSubectEntry frm = new frmSubectEntry();

            frm.lblUserType.Text = lblUserType.Text;
            frm.lblUser.Text     = lblUser.Text;
            frm.Show();
        }