I've tried to achieve this by creating a leave event on the user control, but the message Box isn't appearing for some reason. I also have a panel in front of the user control which I'm thinking might be the issue? Below is the code i have so far:
I have a Modify journey button on the panel, which works fine with the code above, however if i attempt to click on one of the menu tabs across the top such as "My Account" or "Add Booking" which takes the user away from the payment screen i want the application to trigger a MessageBox.
EDIT: when i click on one of the tabs across the top, the message box appears, however if i attempt to put through another booking, get to the payment stage and click on "my account" again. The messageBox doesn't appear
C#:
private void Uc_inputtingPaymentDetails_Leave_1(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("Are you want to navigate away from this page?", "Stop", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
string query = "DELETE from Bookings WHERE bookingId = (select max(BookingId) FROM Bookings)";
_IsqlDataFunctions.ManagingData(query);
string query_1 = "UPDATE Coach set numberOfSeats = numberOfSeats+1 WHERE CoachId = '" + CoachId + "' ";
_IsqlDataFunctions.ManagingData(query_1);
ShowUserControl(new Uc_addBooking());
}
I have a Modify journey button on the panel, which works fine with the code above, however if i attempt to click on one of the menu tabs across the top such as "My Account" or "Add Booking" which takes the user away from the payment screen i want the application to trigger a MessageBox.
EDIT: when i click on one of the tabs across the top, the message box appears, however if i attempt to put through another booking, get to the payment stage and click on "my account" again. The messageBox doesn't appear
Last edited: