private void Table_BTN_Click(object sender, EventArgs e)
        {
            Form T = new FormTable();

            T.Owner = this;
            T.Show();
            this.Hide();
        }
示例#2
0
        private void FormAdd_FormClosed(object sender, FormClosedEventArgs e)
        {
            switch (Add)
            {
            case true:
                Owner.Show();
                break;

            case false:
                Form T = new FormTable();
                T.Owner = this.Owner.Owner;
                T.Show();
                this.Hide();
                break;
            }
        }
        private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int id;

            Int32.TryParse(dataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString(), out id);
            if (dataGridView.Columns[e.ColumnIndex].Name == "Delete")
            {
                Student_DBEntities S       = new Student_DBEntities();
                Student            student = S.Students.FirstOrDefault(x => x.Id == id);
                S.Students.Remove(student);
                S.SaveChanges();
                Form T = new FormTable();
                T.Owner = this.Owner;
                T.Show();
                this.Dispose(false);
            }
            else
            {
                Form T = new FormAdd(id);
                T.Owner = this;
                T.Show();
                this.Hide();
            }
        }