private void addDestinationButton_Click(object sender, EventArgs e) { if (planesListBox.SelectedIndex != -1) { addDestinationFrom = new AddDestination(this); addDestinationFrom.ShowDialog(); planesListBox_SelectedIndexChanged(sender, e); } }
private void addDestination_Click(object sender, EventArgs e) { AddDestination addDestination = new AddDestination(); if (addDestination.ShowDialog() == DialogResult.OK) { Aerodrom a = (Aerodrom)listAirports.SelectedItem; a.Destinations.Add(addDestination.destination); listDest.Items.Add(addDestination.destination); } }