Results 1 to 2 of 2

Thread: How to stop my form from being unloaded?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    90

    How to stop my form from being unloaded?

    I'm not sure how this works, but I have a frmMaster which calls on a global module to perform a large amount of the work... this was to get past the problem with a module's Main() sub ending the program at the end of the sub. Yes, a little cheap, but it works.

    I am just having a little trouble with the form. In the Activated event, I've tried me.Hide and me.Visible = false. These both work, but .NET seems to be unloading the form. While the global module it doing processing, .NET will randomly complain that my form (which is NOT being used) is not set to an instance of an object!

    This is temporarily solved by setting .Opacity to 0, but is there a better way...a way to stop .NET from automatically trying to unload it?

  2. #2
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    Re: How to stop my form from being unloaded?

    if i'm understanding your problem, in the form's closing event handler, tyr this:
    VB Code:
    1. e.cancel
    2. 'or
    3. exit sub
    try one of those two out
    i would put some conditional checks cause the above would NEVER let your form close by themselves

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width