private void buttonChooseVariations_Click(object sender, EventArgs e) { CourseDesignator courseDesignator = courseTreeView.SelectedNode.Tag as CourseDesignator; if (courseDesignator != null) { SelectVariations variationsDialog = new SelectVariations(eventDB, courseDesignator.CourseId); VariationChoices variationChoices; if (variationChoicesPerCourse.TryGetValue(courseDesignator.CourseId, out variationChoices)) { variationsDialog.VariationChoices = variationChoices; } if (variationsDialog.ShowDialog(this) == DialogResult.OK) { variationChoicesPerCourse[courseDesignator.CourseId] = variationsDialog.VariationChoices; } } }