示例#1
0
        /// <summary>
        /// Extra while Mouse DoubleClick one student
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            UpdateDeleteStudentForm updateDeleteForm = new UpdateDeleteStudentForm();

            //Lay du lieu tu Student ID - FName - LName - BirthDate - Gender - Phone - Address - Picture
            updateDeleteForm.TextBoxID.Text        = this.DataGridView1.CurrentRow.Cells[0].Value.ToString();
            updateDeleteForm.TextBoxFirstName.Text = this.DataGridView1.CurrentRow.Cells[1].Value.ToString();
            updateDeleteForm.TextBoxLastName.Text  = this.DataGridView1.CurrentRow.Cells[2].Value.ToString();
            updateDeleteForm.dateTimePicker1.Value = (DateTime)this.DataGridView1.CurrentRow.Cells[3].Value;
            //Gender
            if ((this.DataGridView1.CurrentRow.Cells[4].Value.ToString().Trim() == "Female"))
            {
                updateDeleteForm.RadioButtonFemale.Checked = true;
            }
            else
            {
                updateDeleteForm.RadioButtonMale.Checked = true;
            }
            updateDeleteForm.TextBoxPhone.Text   = this.DataGridView1.CurrentRow.Cells[5].Value.ToString();
            updateDeleteForm.TextBoxAddress.Text = this.DataGridView1.CurrentRow.Cells[6].Value.ToString();

            //Picture
            byte[] pic;
            if (DataGridView1.CurrentRow.Cells[7].Value != DBNull.Value)
            {
                pic = (byte[])this.DataGridView1.CurrentRow.Cells[7].Value;
                MemoryStream picture = new MemoryStream(pic);
                updateDeleteForm.PictureBoxStudentImage.Image = Image.FromStream(picture);
            }
            this.Show();

            updateDeleteForm.Show();
        }
        private void editRemoveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UpdateDeleteStudentForm form = new UpdateDeleteStudentForm();

            form.Show(this);
        }