Beispiel #1
0
        private void dataGridView5_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewRow dr = dataGridView5.SelectedRows[0];

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

            // or simply use column name instead of index
            //dr.Cells["id"].Value.ToString();
            frm.Show();
            frm.ScholarNo.Text      = dr.Cells[0].Value.ToString();
            frm.StudentName.Text    = dr.Cells[1].Value.ToString();
            frm.Course.Text         = dr.Cells[2].Value.ToString();
            frm.Branch.Text         = dr.Cells[3].Value.ToString();
            frm.cmbHostelName.Text  = dr.Cells[4].Value.ToString();
            frm.dtpJoiningDate.Text = dr.Cells[5].Value.ToString();
            if (label5.Text == "Admin")
            {
                frm.btnDelete.Enabled        = true;
                frm.btnUpdate_record.Enabled = true;
                frm.ScholarNo.Focus();
                frm.label3.Text     = label5.Text;
                frm.btnSave.Enabled = false;
            }
            else
            {
                frm.btnDelete.Enabled        = false;
                frm.btnUpdate_record.Enabled = false;
                frm.btnSave.Enabled          = false;
                frm.ScholarNo.Focus();
                frm.label3.Text = label5.Text;
            }
        }
        private void hostelersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmHostelers frm = new frmHostelers();

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