first i am opening X.exe .if i click a button in the form of X.exe ,it should display Y.exe and X.exe should be closed. and when a button is clicked in Y.exe , y.exe should be closed and X.exe should be displayed.
After you fire up any of the EXEs , you simply look up (by name) in the current running processes for the EXE being run , then shut it down , fire up the other exe and follow the same procedure before you close it .I'm not at my dev pc so I can't give you code right now.