private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewRow dr = dataGridView1.SelectedRows[0];

            this.Hide();
            frmBatch frm = new frmBatch();

            // or simply use column name instead of index
            //dr.Cells["id"].Value.ToString();
            frm.Show();
            frm.txtBatchID.Text  = dr.Cells[0].Value.ToString();
            frm.cmbSession.Text  = dr.Cells[1].Value.ToString();
            frm.cmbCourse.Text   = dr.Cells[2].Value.ToString();
            frm.cmbSemester.Text = dr.Cells[3].Value.ToString();
            if (label1.Text == "Admin")
            {
                frm.btnDelete.Enabled        = true;
                frm.btnUpdate_record.Enabled = true;
                frm.label6.Text     = label1.Text;
                frm.btnSave.Enabled = false;
            }
            else
            {
                frm.btnDelete.Enabled        = false;
                frm.btnUpdate_record.Enabled = false;
                frm.btnSave.Enabled          = false;
                frm.label6.Text = label1.Text;
            }
        }
Exemple #2
0
        private void batchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmBatch frm = new frmBatch();

            if (UserType.Text == "Admin")
            {
                frm.label6.Text = UserType.Text;
                frm.Show();
            }
            else
            {
                frm.label6.Text = UserType.Text;
                frm.Show();
            }
        }