all,, I have a project that is built in VB.Net 2010 and WPF 4. I have an option to return to a sign-in screen, yet this option can only be accessed from a separate (quit confirmation) window. This function can be called when one of about a hundred windows are open behind the quit confirmation window.
What I want to do is close the quit confirmation window, and the other window that is open, but open the sign-in window. I know to use “Me.Close()” to close the quit confirmation window, and I know how to open the sign-in window, but I do not know how to close the other window that is open.
Help?
Couldn’t you give the constructor of the quit-confirmation-window a reference to the window it should close when that option is chosen?
Edit: Two examples of how to do it:
Often you’d like to open a confirmation-dialogue when the window is being closed, so you’d create it in the Closing event-handler like this:
Here your window waits for the confirmation dialogue to return (
diag.Showwould not wait), if that is the case you do not need any information about the window in the dialogue itself. (Resultis a custom property that you can define in your dialogue if theDialogResultbool is not differentiated enough)If your dialogue is opened whenever and you cannot wait for it to return you can create it with a reference:
and in your dialogue code:
or something like that. Alternatively you could work with events as well.