private void takePlane(object sender,EventArgs e) { //take the plane as selected one to the AddFlight Form //button is not on form as it is made from the above code //Problem with code only last added flight is coming Button clickButton = (Button) sender; string s = clickButton.Name; //above method we assign names to buttons so here we get it and can pass it int i = Convert.ToInt16(s.Substring(3,1)); AddFlight adfl = new AddFlight(); this.Close(); adfl.showPlane(i); adfl.Show(); }
private void button2_Click(object sender, EventArgs e) { AddFlight af = new AddFlight(); af.Show(); }