private void btnEdit_Click(object sender, EventArgs e) { try { using (coach_crud previewCC = new coach_crud()) { previewCC.objstate = (int)Enums.Checked.Update; previewCC.lblFormName.Text = "Тренер: Редактирование"; previewCC.txtid_coach.Text = DataGridCoachs.CurrentRow.Cells[0].Value.ToString(); previewCC.txtFirstname.Text = DataGridCoachs.CurrentRow.Cells[1].Value.ToString(); previewCC.txtLastname.Text = DataGridCoachs.CurrentRow.Cells[2].Value.ToString(); previewCC.txtCountry.Text = DataGridCoachs.CurrentRow.Cells[3].Value.ToString(); previewCC.txtexp.Text = DataGridCoachs.CurrentRow.Cells[4].Value.ToString(); previewCC.txtBirthday.Text = DataGridCoachs.CurrentRow.Cells[5].FormattedValue.ToString(); previewCC.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { LoadData(); } }
private void btnAdd_Click(object sender, EventArgs e) { using (coach_crud previewCC = new coach_crud()) { previewCC.txtid_coach.Visible = false; previewCC.lblId_team.Visible = false; previewCC.objstate = (int)Enums.Checked.Insert; previewCC.lblFormName.Text = "Тренер: Добавление"; previewCC.ShowDialog(); } LoadData(); }