private void cboProfiles_SelectedIndexChanged(object sender, EventArgs e) { if (!(sender is ComboBox)) return; ComboBox cb = sender as ComboBox; string txt = cb.SelectedItem as string; //MessageBox.Show((sender as ComboBox).SelectedItem as string); og = sp.GetOptionGroup(txt); }
public OptionGroup GetOptionGroup(string name) { if (string.IsNullOrEmpty(name)) throw new NullReferenceException(); if (_dict.ContainsKey(name)) return _dict[name]; // If the key is not found, create a new blank option group OptionGroup og = new OptionGroup { Name = name }; _dict.Add(name, og); return og; }