protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); if (MessageBox.Show("Have you clicked the Header row to ensure the data saves?", "Clicked the Header Row?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (DataRow row in _dataSet.Group) { EmitScoreDataSet.GroupRow group = (EmitScoreDataSet.GroupRow)row; if (group.GroupId == _groupId) { if (!group.IsTeamIdNull()) { group.BeginEdit(); EmitScoreDataSet.TeamRow team = _dataSet.Team.FindByTeamId(group.TeamId); group.CategoryId = team.CategoryId; group.EndEdit(); } } } groupTableAdapter.Update(_dataSet.Group); } else { e.Cancel = true; } }
private void FrmGroups_FormClosing(object sender, FormClosingEventArgs e) { foreach (DataRow row in _dataSet.Group) { EmitScoreDataSet.GroupRow group = (EmitScoreDataSet.GroupRow)row; if (!group.IsTeamIdNull()) { group.BeginEdit(); EmitScoreDataSet.TeamRow team = _dataSet.Team.FindByTeamId(group.TeamId); group.CategoryId = team.CategoryId; group.EndEdit(); } } groupTableAdapter.Update(_dataSet.Group); }