I have a Form (frmcustlist). At one time on this list i scan the list using a dataset and check if it now 0 (no customers left).
At this stage i have an input box pop up (dialog) to ask a new customer name. If they press OK everything is fine. I also have validation on the box for the input. However if they press CANCEL, i can get it to escape out of the dialog, but not close frmcustlist that the dialog was called from.
using (inputbox ipfirst = new inputbox("Enter Customer First Name:", "", ""))
{
if (ipfirst.ShowDialog() == DialogResult.OK)
{
newfirstname = ipfirst.answer;
}
else
{
this.Close();
}
}
Now, this.close()
doesn't work at all.. so i used return;
which stops it going on to ask for the last name and date of birth.. but i want it to stop asking questions (like return) AS WELL as close frmcustlist.
...
Thanks for any advice you can give.
ps. this appears in a few places, but is called in frmcustlist_load
as well.. i dont know if that is going to make a difference or not!
Answer was made by STEVE in comments. As frmcustlist was called itself as a Dialog, i just ended up having to give that dialog a Cancel result.
Final Code that works: