Code to know whether APP / DIALOG BOX is OPEN or CLOSED . . .
All --
Is there a way that code can run when an APP is OPEN or CLOSED within PREMIER or to tell whether an APP / DIALOG BOX is OPEN or CLOSED?
Code placed in
** PREMIER is RUN rather than when the APP is OPENED.
** WORKBENCH switches from the EDIT MODE to the LOAD MODE
Code placed in
** PREMIER is EXITED rather than when the APP is CLOSED.
** WORKBENCH switches from the LOAD MODE to the EDIT MODE
I'd like this bit of code to run once when the DIALOG BOX is OPENED and perhaps a bit of CLEANUP CODE to run when the DIALOG BOX is CLOSED.
Is there a way to make that happen?
Thanks.
-- Matt
Is there a way that code can run when an APP is OPEN or CLOSED within PREMIER or to tell whether an APP / DIALOG BOX is OPEN or CLOSED?
Code placed in
Sub MyControl_Loadseems to run when:
** PREMIER is RUN rather than when the APP is OPENED.
** WORKBENCH switches from the EDIT MODE to the LOAD MODE
Code placed in
Sub Finalizeseems to run when:
** PREMIER is EXITED rather than when the APP is CLOSED.
** WORKBENCH switches from the LOAD MODE to the EDIT MODE
I'd like this bit of code to run once when the DIALOG BOX is OPENED and perhaps a bit of CLEANUP CODE to run when the DIALOG BOX is CLOSED.
Is there a way to make that happen?
Thanks.
-- Matt
0
Best Answer
-
Hi Matt,
You can use these events to track hide/show:Private Sub MyControl_AppLoading() Handles MyControl.AppLoading MsgBox("AppLoading") End Sub Private Sub MyControl_AppUnloading() Handles MyControl.AppUnloading MsgBox("AppUnloading") End Sub
MyControl is derived from UserControl (https://msdn.microsoft.com/en-us/library/system.windows.forms.usercontrol(v=vs.110).aspx ), so you can also use any of UserControl events.
Regards,
Yuri
0
Answers
Thank you for your reply with CODE EXAMPLES and URL.
I have tried your code and it works GREAT.
Now I can shift some code from
to
so the code runs when the APP OPENS.
This will save CLOSING and REOPENING the PREMIER or EDITING and LOADING the PROJECT.
I've scanned the info at the URL and I will revisit it later.
Thanks again.
-- Matt
FYI . . .
It seems that
runs nicely when an APP is opened from the APPS RIBBON + APPS SECTION + APP BUTTON but it does not seem to run when the APP is started / restarted via the LOAD button within the PROJECT WORKBENCH.
I hope this information is helpful.
-- Matt