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

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

            // or simply use column name instead of index
            //dr.Cells["id"].Value.ToString();
            frm.Show();
            frm.txtHostelID.Text   = dr.Cells[0].Value.ToString();
            frm.txtHostelName.Text = dr.Cells[1].Value.ToString();
            frm.txtHostelFees.Text = dr.Cells[2].Value.ToString();
            if (label1.Text == "Admin")
            {
                frm.btnDelete.Enabled        = true;
                frm.btnUpdate_record.Enabled = true;
                frm.btnSave.Enabled          = false;
                frm.txtHostelName.Focus();
                frm.label1.Text = label1.Text;
            }
            else
            {
                frm.btnDelete.Enabled        = false;
                frm.btnUpdate_record.Enabled = false;
                frm.btnSave.Enabled          = false;
                frm.txtHostelName.Focus();
                frm.label1.Text = label1.Text;
            }
        }
        private void hostelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmHostel frm = new frmHostel();

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