Results 1 to 5 of 5

Thread: Pogram does not terminate but stays as a process!!!

  1. #1

    Thread Starter
    Addicted Member jastrzebiec's Avatar
    Join Date
    Nov 2010
    Posts
    173

    Pogram does not terminate but stays as a process!!!

    Hello,
    I have this strange problem.
    Sometimes (I cannot figure out exactly curcimstances), my application does not unload from Windows, looses GUI and remains running as a process.
    What can cause that?
    My unloading routine contains this:
    Dim F As Form
    For Each F In Forms
    Unload F
    Next
    as the last lines of code.
    That was fine working for the last 10 years, but now I have started having that problem.
    Your thoughts appreciated,
    jas

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Pogram does not terminate but stays as a process!!!

    Do you have it in the form_unload event?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Pogram does not terminate but stays as a process!!!

    Code:
    Dim F As Form
    For Each F In Forms
    If F.Name <> Me.Name Then Unload F
    Next
    Unload Me
    May help.

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Pogram does not terminate but stays as a process!!!

    Or just use proper owner relationships (the Owner argument of the Show method).

    These kinds of "sweep all Forms" loops smack of general disorganization in a program. There may even be other orphaned objects keeping the program running. This is usually caused by circular references.

    You might read the manual, in particular Visual Basic Component Shutdown Rules, Starting and Ending a Component, Dealing with Circular References, and similar topics.

    But usually you're using the default instances of Forms (the ones with the same name as the Form class that you get "for free"). These have "As New" semantics, and touching the variable after unloading it causes a new instance to be reloaded. That's what Magic Ink is probably getting at above.

  5. #5
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    Re: Pogram does not terminate but stays as a process!!!

    Magic Ink's code should work to unload all of your app's forms (make sure you put it in your app's main form). Then if your application still does not close, you might have other code running from other "formless" areas of your application eg a formless timer, or you have set references to objects that are persisting in memory and which must be removed for your application to close, in which case check for any global objects and make sure they are also closed properly prior to exiting your application.
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

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