Beispiel #1
0
        //edit student in print form (click cell in dgv)
        private void StudentDgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            FormEditRemove edit = new FormEditRemove();

            edit.ID_txt.Text           = info_dgv.CurrentRow.Cells[0].Value.ToString();
            edit.fName_txt.Text        = info_dgv.CurrentRow.Cells[1].Value.ToString();
            edit.lName_txt.Text        = info_dgv.CurrentRow.Cells[2].Value.ToString();
            edit.dateTimePicker1.Value = (DateTime)info_dgv.CurrentRow.Cells[3].Value;
            if ((info_dgv.CurrentRow.Cells[4].Value.ToString() == "Female    "))
            {
                edit.fMale_rbtn.Checked = true;
            }
            else
            {
                edit.Male_rbtn.Checked = true;
            }
            edit.phone_txt.Text   = info_dgv.CurrentRow.Cells[5].Value.ToString();
            edit.address_txt.Text = info_dgv.CurrentRow.Cells[6].Value.ToString();
            byte[] pic;
            pic = (byte[])info_dgv.CurrentRow.Cells[7].Value;
            MemoryStream picture = new MemoryStream(pic);

            edit.picture_ptb.Image = Image.FromStream(picture);
            edit.Show();
        }
Beispiel #2
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            FormEditRemove editRemove = new FormEditRemove();

            editRemove.ID_txt.Text           = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            editRemove.fName_txt.Text        = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            editRemove.lName_txt.Text        = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            editRemove.dateTimePicker1.Value = (DateTime)dataGridView1.CurrentRow.Cells[3].Value;

            if ((dataGridView1.CurrentRow.Cells[4].Value.ToString() == "Female"))
            {
                editRemove.fMale_rbtn.Checked = true;
            }
            editRemove.phone_txt.Text   = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            editRemove.address_txt.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();

            byte[] pic;
            pic = (byte[])dataGridView1.CurrentRow.Cells[7].Value;
            MemoryStream picture = new MemoryStream(pic);

            editRemove.picture_ptb.Image = Image.FromStream(picture);
            editRemove.Show(this);
        }