Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Error to close form

Error to close form

Scheduled Pinned Locked Moved Visual Basic
help
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nei2009
    wrote on last edited by
    #1

    Quote:

    Friend What could be happening, because when I say close a form with unload me, it is giving the following error: Unable to unload within this context

    D L 2 Replies Last reply
    0
    • N nei2009

      Quote:

      Friend What could be happening, because when I say close a form with unload me, it is giving the following error: Unable to unload within this context

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Show the code where this is happening.

      A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      1 Reply Last reply
      0
      • N nei2009

        Quote:

        Friend What could be happening, because when I say close a form with unload me, it is giving the following error: Unable to unload within this context

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        "Unload" is something from VB6 - VB.NET has a garbage collector. It will be unloaded as soon as there are no active references to the form.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        N 1 Reply Last reply
        0
        • L Lost User

          "Unload" is something from VB6 - VB.NET has a garbage collector. It will be unloaded as soon as there are no active references to the form.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          N Offline
          N Offline
          nei2009
          wrote on last edited by
          #4

          Friends

          Passing more information on the problem for better understanding.
          See the routine below it is very simple, however I'm getting intermittent error in my application.
          Searching the error I got the link below, but checking my process I did not find anything related to the item resize.
          If anyone has any other information that can help me in this matter thank you for the attention.
          

          Private Sub cmdExit_Click()
          On Error GoTo TryCathError
          Unload Me
          Exit Sub
          TryCathError:
          Dim s_dsMsg As String
          s_dsMsg = "Error :{" & Err.Number & "}" _
          & vbNewLine & Err.Description

          MsgBox s_dsMsg, vbCritical, "Error"
          End Sub

          link ===> msdn.microsoft.com/en-us/library/aa243662(v=vs.60).aspx

          There is an Unload statement in the Resize event of a Data, Form, MDIForm, or PictureBox control.
          Remove the Unload statement from the event.

          L 1 Reply Last reply
          0
          • N nei2009

            Friends

            Passing more information on the problem for better understanding.
            See the routine below it is very simple, however I'm getting intermittent error in my application.
            Searching the error I got the link below, but checking my process I did not find anything related to the item resize.
            If anyone has any other information that can help me in this matter thank you for the attention.
            

            Private Sub cmdExit_Click()
            On Error GoTo TryCathError
            Unload Me
            Exit Sub
            TryCathError:
            Dim s_dsMsg As String
            s_dsMsg = "Error :{" & Err.Number & "}" _
            & vbNewLine & Err.Description

            MsgBox s_dsMsg, vbCritical, "Error"
            End Sub

            link ===> msdn.microsoft.com/en-us/library/aa243662(v=vs.60).aspx

            There is an Unload statement in the Resize event of a Data, Form, MDIForm, or PictureBox control.
            Remove the Unload statement from the event.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You don't unload in VB.NET; ..and the suggestion from the other site to include an exit-sub is also nonsense. What language are you targetting? And why do you think you need to dispose something that is in use? Unloading "Me" while you are executing one of its members is like stealing a cup while somebody is drinking coffee.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            N 1 Reply Last reply
            0
            • L Lost User

              You don't unload in VB.NET; ..and the suggestion from the other site to include an exit-sub is also nonsense. What language are you targetting? And why do you think you need to dispose something that is in use? Unloading "Me" while you are executing one of its members is like stealing a cup while somebody is drinking coffee.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              N Offline
              N Offline
              nei2009
              wrote on last edited by
              #6

              Quote:

              Eddy Vluggen / Grupo I'm programming with vb 6, the error I passed is code 365 Unable to unload within this context

              M L 2 Replies Last reply
              0
              • N nei2009

                Quote:

                Eddy Vluggen / Grupo I'm programming with vb 6, the error I passed is code 365 Unable to unload within this context

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                In which case you have wasted EVERYONE's time. VB6 is no longer supported. Download VB.net.

                Never underestimate the power of human stupidity RAH

                N 1 Reply Last reply
                0
                • N nei2009

                  Quote:

                  Eddy Vluggen / Grupo I'm programming with vb 6, the error I passed is code 365 Unable to unload within this context

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  nei2009 wrote:

                  I'm programming with vb 6

                  VB6 is no longer supported. Good luck with it.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  N 1 Reply Last reply
                  0
                  • M Mycroft Holmes

                    In which case you have wasted EVERYONE's time. VB6 is no longer supported. Download VB.net.

                    Never underestimate the power of human stupidity RAH

                    N Offline
                    N Offline
                    nei2009
                    wrote on last edited by
                    #9

                    Group

                    Quote:

                    How sad, but thank you for your attention.

                    1 Reply Last reply
                    0
                    • L Lost User

                      nei2009 wrote:

                      I'm programming with vb 6

                      VB6 is no longer supported. Good luck with it.

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                      N Offline
                      N Offline
                      nei2009
                      wrote on last edited by
                      #10

                      Group

                      Quote:

                      How sad, but thank you for your attention.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups