Ejemplo n.º 1
0
        private void dgvTraining_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Training tr = dgvTraining.SelectedRows[0].DataBoundItem as Training;

            if (e.ColumnIndex == 3)
            {
                frmMembersTraining frm = new frmMembersTraining(tr);
                frm.ShowDialog();
            }
            else if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("Are you sure?", "Delete",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Question,
                                                        MessageBoxDefaultButton.Button2);

                if (response == DialogResult.Yes)
                {
                    connectionToBase.Training.Remove(tr);
                    connectionToBase.SaveChanges();
                    LoadData();
                }
            }
        }
 public frmMembersTraining(Training tr) : this()
 {
     this.tr = tr;
 }