Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

application not terminating!!!

kapiloo7kapiloo7 Posts: 45Member
hii everybody,
i have an applicatin which is not closing completely. i.e. when i run it from VB Dev Environment and close that application vb remain in [run] mode and not returning in design mode.
what can be the possibile causes for this problem? plz help me if any body can?

Comments

  • GenjuroGenjuro Posts: 913Member
    : hii everybody,
    : i have an applicatin which is not closing completely. i.e. when i run it from VB Dev Environment and close that application vb remain in [run] mode and not returning in design mode.
    : what can be the possibile causes for this problem? plz help me if any body can?
    :

    Check out if all Forms in your app have been unloaded - not just hidden, but unloaded (this is the most likely cause).
    The easy way to do so is to write a function in a standard module which iterates using "for each" over all the Forms global, predefined collection, and Debug.Print their Name property.

    Then, when you close your app, if it remains in run mode, call that function from the Immediate window and look at the output, so you can easily see which Form hasn't been unloaded, if any.
  • kapiloo7kapiloo7 Posts: 45Member
    : Check out if all Forms in your app have been unloaded - not just hidden, but unloaded (this is the most likely cause).
    : The easy way to do so is to write a function in a standard module which iterates using "for each" over all the Forms global, predefined collection, and Debug.Print their Name property.
    :
    : Then, when you close your app, if it remains in run mode, call that function from the Immediate window and look at the output, so you can easily see which Form hasn't been unloaded, if any.
    :

    here i am using only one form and all other are classes.
    and there is a long object heirarchy and main thing is application is
    not closing in the function where it started.
  • dokken2dokken2 Posts: 532Member
    : : Check out if all Forms in your app have been unloaded - not just hidden, but unloaded (this is the most likely cause).
    : : The easy way to do so is to write a function in a standard module which iterates using "for each" over all the Forms global, predefined collection, and Debug.Print their Name property.
    : :
    : : Then, when you close your app, if it remains in run mode, call that function from the Immediate window and look at the output, so you can easily see which Form hasn't been unloaded, if any.
    : :
    :
    : here i am using only one form and all other are classes.
    : and there is a long object heirarchy and main thing is application is
    : not closing in the function where it started.
    :

    Are you disposing all your class objects. Also, stuck in a loop somewhere and not returning to your initial function. Set some break points and single step your code to see where it may be hanging.
  • kapiloo7kapiloo7 Posts: 45Member
    hii everybody again,
    i have worked on this problem and found that problem is with socket. actualy i have a form and socket variable in a class.

    [code]
    Private mForm As FormBase
    Private WithEvents wsServer As Winsock
    [/code]

    and i am adding socket to form like this

    [code]
    Set mForm = New FormBase
    Set wsServer = mForm.Controls.Add("MSWinsock.Winsock.1", "wsSocket")
    [/code]

    and when terminating the class i am setting the variable to nothing
    [code]
    Private Sub Class_Terminate()
    '
    mForm.Controls.Remove ("wsSocket")
    Set mForm = Nothing
    Set wsServer = Nothing
    '
    End Sub
    [/code]

    before closing application all the objects are set to nothing. but application doesn't closes. every thing works fine if i dont have that
    socket class.

    plz help me out of this. thanx to all in advance

  • infidelinfidel Posts: 2,900Member
    : hii everybody again,
    : i have worked on this problem and found that problem is with socket. actualy i have a form and socket variable in a class.
    :
    : [code]
    : Private mForm As FormBase
    : Private WithEvents wsServer As Winsock
    : [/code]
    :
    : and i am adding socket to form like this
    :
    : [code]
    : Set mForm = New FormBase
    : Set wsServer = mForm.Controls.Add("MSWinsock.Winsock.1", "wsSocket")
    : [/code]
    :
    : and when terminating the class i am setting the variable to nothing
    : [code]
    : Private Sub Class_Terminate()
    : '
    : mForm.Controls.Remove ("wsSocket")
    : Set mForm = Nothing
    : Set wsServer = Nothing
    : '
    : End Sub
    : [/code]
    :
    : before closing application all the objects are set to nothing. but application doesn't closes. every thing works fine if i dont have that
    : socket class.
    :
    : plz help me out of this. thanx to all in advance

    Unless I'm mistaken, the form still has to be [b]Unload[/b]ed first.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • kapiloo7kapiloo7 Posts: 45Member

    : Unless I'm mistaken, the form still has to be [b]Unload[/b]ed first.

    u r definitely not mistaken. its working.

    thanx a lot for the help!!!
Sign In or Register to comment.