private void spawn_Click(object sender, EventArgs e) { try { Type t = (Type)cbGraphTypes.SelectedItem; KillGraph(); Graph = (BaseGraph)Activator.CreateInstance(t); MessageBox.Show(this, "Spawn Successful"); } catch (TargetInvocationException ex) { if (ex.InnerException != null) { MessageBox.Show(this, ex.InnerException.ToString()); } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }