views:

58

answers:

2

Hi,

I am developing an application for windows mobile in which I have a logout functionality at each form I open.

So while pressing the logout button I am able to delete the username password from the memory but I am not able to drag the user to the login screen again while freeing all the memory and closing all the forms.

Anybody knowing the answer plz help me out.

+1  A: 

Try this. Your main form becomes a "shell" with a logout button (or possibly you do that via a MainMenu object). Then rewrite your other forms into UserControls instead. Then when the user "moves" to a new page just initialise the usercontrol and slap it into the .Controls collection in your shell form (oh and remove the current one first :) ).

Technically you always remain on the first form this way, you don't need to duplicate the logout code/UI and moving the user back to the login page is easy, just remove the "Current" usercontrol and replace it with the "Login" user control.

Quibblesome
Hey thanks for the answer but I am totally new to this this technology. So can you please give me some more help about this solution.
Madhup
A: 

Hi,

Finally I have found a way to do this though not the best way to do this. I am maintaining a static bool in login form which is set to true when user presses the logout button. Now after this at each form in OnFocus Event I check whether that variable is set to yes if it is ,I close the form and so on till i reach the login form.

If somebody knows better solution plzz tell.

Or if you like this answer plz vote it.

Madhup
Sorry but that is a horrible solution.
Quibblesome
ya i also think that but if you know the better way please tell.
Madhup