//This shows the MakeABookingChoice form and if the user clicks 'Bus', the BusBookingForm will appear, if they click 'Booking', the BookingForm will appear private void button2_Click(object sender, EventArgs e) { using (var form = new MakeABookingChoice()) { var result = form.ShowDialog(); if (result == DialogResult.Yes) { this.Hide(); new BusBookingForm(db).Show(); } else if (result == DialogResult.No) { this.Hide(); new BookingForm(db).Show(); } } }
//If the 'Make A Booking button is clicked' private void button5_Click(object sender, EventArgs e) { //Show the form using (var form = new MakeABookingChoice()) { var result = form.ShowDialog(); //If the user clicks 'Bus' if (result == DialogResult.Yes) { //Show the busbooking form this.Hide(); new BusBookingForm(db).Show(); } //If the user clicks 'Booking' else if (result == DialogResult.No) { //show the booking form this.Hide(); new BookingForm(db).Show(); } } }