My first road block on VB.net Tuesday, August 21, 2007

Fine the application I was developing was the typical one as you fire the app the login screen comes up. On response from the login page either it opened a MDI form or it may exit the program.

Problem: If I exit from the main login form which was in the main() section the program would exit clean and release all resources.

   1:  'on failed auth do following
   2:  Me.close ' close the login form   3:   




I could not find a way to show my MDI main form after a success authentication and hiding or killing the login form. So I did following 


   1:  'on sucess auth 
   2:  Me.hide() ' this would hide the login form 
   3:  mymdiform.show() 'show the form

the problem with this approach was that If I close the MDI form invoked by the login form it (login) still remains in the memory and does not release it. Even if the form is not visible on the screen it is still in memory hogging memory. Now the question was how to get rid of this problem


   1:  Me.Dispose() ' Dispose the MDI form
   2:  Application.Exit() ' Dispose the whole application


this did the trick the whole application would close, when the click event calls the above code it works. Not only this the classic window cross also works after this piece of code

0 comments: