B
BobRoyAce
I have an Visual Studio 2005 WinForms application in which I have a
main form with a NavBar on the left, a menu and toolbar at the top, and
a working area panel on the right. Depending on which link on the
NavBar the user clicks on, I show the corresponding User Control in the
working area panel on the main form (make the panel the User Control's
parent).
What I want to do is this...If the user attempts to click on another
item in the NavBar, to try to go to another User Control, I want to
first execute code to make sure that all is well with data entered on
the control they're going to be "leaving". If it's not, I want to show
a message and keep them on the current control. If all is well, I let
things go. How can I implement this? Is there an event that I can use
for this? Just FYI, at this time, I simply make the control invisible
(after it's initially loaded the first time) when moving to another
control. I know there's a VisibleChanged event, but I'm thinking that's
not the place.
Also, how 'bout when the user attempts to exit the application. Is
there a nice way to do the same thing before allowing the application
to close (i.e. make sure all is cool on the current control?
main form with a NavBar on the left, a menu and toolbar at the top, and
a working area panel on the right. Depending on which link on the
NavBar the user clicks on, I show the corresponding User Control in the
working area panel on the main form (make the panel the User Control's
parent).
What I want to do is this...If the user attempts to click on another
item in the NavBar, to try to go to another User Control, I want to
first execute code to make sure that all is well with data entered on
the control they're going to be "leaving". If it's not, I want to show
a message and keep them on the current control. If all is well, I let
things go. How can I implement this? Is there an event that I can use
for this? Just FYI, at this time, I simply make the control invisible
(after it's initially loaded the first time) when moving to another
control. I know there's a VisibleChanged event, but I'm thinking that's
not the place.
Also, how 'bout when the user attempts to exit the application. Is
there a nice way to do the same thing before allowing the application
to close (i.e. make sure all is cool on the current control?