private void addAbilityButton_Click(object sender, EventArgs e) { AbilitiesForm d = new AbilitiesForm(); if (d.ShowDialog() == DialogResult.OK) { Type abilityType = asm.GetType("Elena." + d.SelectedNode().Name); bool propertyGenerated; MonsterAbility ability; try { ability = (MonsterAbility)Activator.CreateInstance(abilityType); propertyGenerated = true; } catch { propertyGenerated = false; ability = new NullAbility(); } if (propertyGenerated) { if (selectedAbility.IsNull) { monster.AddAbility(ability); } else { monster.AddAbility(ability, selectedAbility); } selectedAbility = new NullAbility(); } this.UpdateData(); } }