Unload for my Form1 ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    #1

    Unload for my Form1 ?

    why is that

    Public Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    works fine, but

    Public Sub Form1_Unload(By Val sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    seems not to work at all ? what is a valid function name during
    unloading (through clicking "X" in right corner of the Form1 window).
    Note Form1 is my main window.


    Thanks

  • Doug Glancy

    #2
    Re: Unload for my Form1 ?

    Joe,

    I believe the 2nd one needs to say "Handles MyBase.Unload", in any case not
    "MyBase.Loa d".

    hth,

    Doug

    "Joe" <joe1977@tlen.p lwrote in message
    news:1172505371 .369968.273990@ z35g2000cwz.goo glegroups.com.. .
    why is that
    >
    Public Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    >
    works fine, but
    >
    Public Sub Form1_Unload(By Val sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    >
    seems not to work at all ? what is a valid function name during
    unloading (through clicking "X" in right corner of the Form1 window).
    Note Form1 is my main window.
    >
    >
    Thanks
    >

    Comment

    • Joe

      #3
      Re: Unload for my Form1 ?

      On Feb 26, 11:32 am, "Doug Glancy" <nobodyh...@rep lytogroup.com>
      wrote:
      Joe,
      >
      I believe the 2nd one needs to say "Handles MyBase.Unload", in any case not
      "MyBase.Loa d".
      >
      unfortunately, MyBase.Unload does not exist, neither "Close", "Exit",
      "Quit" or "CloseThrea t"

      :(

      Comment

      • RobinS

        #4
        Re: Unload for my Form1 ?

        The second one assigned the load event to the unload routine.

        If you are trying to capture the unload event, look at Form_Closing, not
        Form_Unload.

        Robin S.
        -------------------------
        "Joe" <joe1977@tlen.p lwrote in message
        news:1172505371 .369968.273990@ z35g2000cwz.goo glegroups.com.. .
        why is that
        >
        Public Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        >
        works fine, but
        >
        Public Sub Form1_Unload(By Val sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        >
        seems not to work at all ? what is a valid function name during
        unloading (through clicking "X" in right corner of the Form1 window).
        Note Form1 is my main window.
        >
        >
        Thanks
        >

        Comment

        • Joe

          #5
          Re: Unload for my Form1 ?

          Public Sub Form1_Closing(B yVal sender As System.Object, ByVal e As
          System.EventArg s)

          MsgBox("g-bye!")

          End Sub


          does not show this message.

          note that my main form is "Form1"


          Form1_Load works however


          On Feb 26, 2:32 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
          The second one assigned the load event to the unload routine.
          >
          If you are trying to capture the unload event, look at Form_Closing, not
          Form_Unload.
          >
          Robin S.
          -------------------------"Joe" <joe1...@tlen.p lwrote in message
          >
          news:1172505371 .369968.273990@ z35g2000cwz.goo glegroups.com.. .
          >
          >
          >
          why is that
          >
          Public Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
          System.EventArg s) Handles MyBase.Load
          >
          works fine, but
          >
          Public Sub Form1_Unload(By Val sender As System.Object, ByVal e As
          System.EventArg s) Handles MyBase.Load
          >
          seems not to work at all ? what is a valid function name during
          unloading (through clicking "X" in right corner of the Form1 window).
          Note Form1 is my main window.
          >
          Thanks- Hide quoted text -
          >
          - Show quoted text -

          Comment

          • Armin Zingler

            #6
            Re: Unload for my Form1 ?

            "Joe" <joe1977@tlen.p lschrieb
            Public Sub Form1_Closing(B yVal sender As System.Object, ByVal e As
            System.EventArg s)
            >
            MsgBox("g-bye!")
            >
            End Sub
            >
            >
            does not show this message.
            >
            note that my main form is "Form1"
            >
            >
            Form1_Load works however

            "Handles" is missing.


            Armin

            Comment

            • Joe

              #7
              Re: Unload for my Form1 ?

              wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
              exist... MyBase.Quit? not exist...
              MyBase.Load will work just on loading form not on unloading...




              On Feb 26, 3:55 pm, "Armin Zingler" <az.nos...@free net.dewrote:
              "Joe" <joe1...@tlen.p lschrieb
              >
              Public Sub Form1_Closing(B yVal sender As System.Object, ByVal e As
              System.EventArg s)
              >
              MsgBox("g-bye!")
              >
              End Sub
              >
              does not show this message.
              >
              note that my main form is "Form1"
              >
              Form1_Load works however
              >
              "Handles" is missing.
              >
              Armin

              Comment

              • lord.zoltar@gmail.com

                #8
                Re: Unload for my Form1 ?

                On Feb 26, 5:03 pm, "Joe" <joe1...@tlen.p lwrote:
                wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
                exist... MyBase.Quit? not exist...
                MyBase.Load will work just on loading form not on unloading...
                >
                Maybe the events you are looking for are FormClosing or FormClosed?

                Comment

                • Joe

                  #9
                  Re: Unload for my Form1 ?

                  ok, finally the answer is:

                  Private Sub Form1_FormClose d(ByVal sender As System.Object, ByVal
                  e As System.Windows. Forms.FormClose dEventArgs) Handles
                  MyBase.FormClos ed


                  thanks anyone!



                  On Feb 26, 5:28 pm, lord.zol...@gma il.com wrote:
                  On Feb 26, 5:03 pm, "Joe" <joe1...@tlen.p lwrote:
                  >
                  wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
                  exist... MyBase.Quit? not exist...
                  MyBase.Load will work just on loading form not on unloading...
                  >
                  Maybe the events you are looking for are FormClosing or FormClosed?

                  Comment

                  • Armin Zingler

                    #10
                    Re: Unload for my Form1 ?

                    "Joe" <joe1977@tlen.p lschrieb
                    wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
                    exist... MyBase.Quit? not exist...
                    MyBase.Load will work just on loading form not on unloading...
                    ...Handles mybase.formclos ing


                    Armin

                    Comment

                    • Cor Ligthert [MVP]

                      #11
                      Re: Unload for my Form1 ?

                      Joe,

                      As was told to you already by Armin Zingler some rows before, where you gave
                      the nice answer.

                      "wel.. handles what?"

                      It is strange that Armin and Lord Zoltar were going on helping you.

                      You are completely helped to come to your answer and did not even thank

                      Cor

                      "Joe" <joe1977@tlen.p lschreef in bericht
                      news:1172530260 .853716.285670@ 8g2000cwh.googl egroups.com...
                      ok, finally the answer is:
                      >
                      Private Sub Form1_FormClose d(ByVal sender As System.Object, ByVal
                      e As System.Windows. Forms.FormClose dEventArgs) Handles
                      MyBase.FormClos ed
                      >
                      >
                      thanks anyone!
                      >
                      >
                      >
                      On Feb 26, 5:28 pm, lord.zol...@gma il.com wrote:
                      >On Feb 26, 5:03 pm, "Joe" <joe1...@tlen.p lwrote:
                      >>
                      wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
                      exist... MyBase.Quit? not exist...
                      MyBase.Load will work just on loading form not on unloading...
                      >>
                      >Maybe the events you are looking for are FormClosing or FormClosed?
                      >
                      >

                      Comment

                      • RobinS

                        #12
                        Re: Unload for my Form1 ?

                        Just FYI, there are two events -- Form_Closing and Form_Closed.
                        Form_Closing fires before you close the form, and can be cancelled.
                        Form_Closed fires *after* the form hasclosed.

                        Robin S.
                        -----------------------------------
                        "Joe" <joe1977@tlen.p lwrote in message
                        news:1172530260 .853716.285670@ 8g2000cwh.googl egroups.com...
                        ok, finally the answer is:
                        >
                        Private Sub Form1_FormClose d(ByVal sender As System.Object, ByVal
                        e As System.Windows. Forms.FormClose dEventArgs) Handles
                        MyBase.FormClos ed
                        >
                        >
                        thanks anyone!
                        >
                        >
                        >
                        On Feb 26, 5:28 pm, lord.zol...@gma il.com wrote:
                        >On Feb 26, 5:03 pm, "Joe" <joe1...@tlen.p lwrote:
                        >>
                        wel.. handles what? MyBase.Unload? not exist...MyBase. Closing? not
                        exist... MyBase.Quit? not exist...
                        MyBase.Load will work just on loading form not on unloading...
                        >>
                        >Maybe the events you are looking for are FormClosing or FormClosed?
                        >
                        >

                        Comment

                        Working...