opening a new form and closing when done

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gobblegob
    New Member
    • Dec 2007
    • 133

    opening a new form and closing when done

    basically my program has 2 forms i open the second form with form2.show for input then i want to go back to form1 but i want form 2 to close

    Thanks
    Gobble.
    Last edited by Killer42; Jan 28 '08, 03:57 AM.
  • ameesha
    New Member
    • Jan 2008
    • 7

    #2
    use the code


    form2.hide

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      Hello there,

      try using Unload Form2


      Better Than Yesterday

      Comment

      • jamesd0142
        Contributor
        • Sep 2007
        • 471

        #4
        Originally posted by werks
        Hello there,

        try using Unload Form2


        Better Than Yesterday

        if you do this then im sure all the information on form 2 will be lost when it closes.
        so best use form.hide as advised in the previous post.

        unless of course you send the info to form1 on form2.closing method :D

        Thanks James

        Comment

        • VACEPROGRAMER
          Banned
          New Member
          • Nov 2007
          • 167

          #5
          Yes Form2.hide will take a effect.I have same program and is use taht code.

          Vace

          Comment

          • Ali Rizwan
            Banned
            Contributor
            • Aug 2007
            • 931

            #6
            You can use a timer to close form automatically or you can use a button to do this thing also just add this code under any objects event.

            Code:
            Unload Form2
            or

            Code:
            Me.Hide
            or
            Code:
            Form2.Hide
            Regards
            >> ALI <<

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Don't forget, you can open the form "modally", in which case the original code will pause and wait for it to be hidden or closed before continuing.

              Comment

              • shuvo2k6
                New Member
                • Jan 2008
                • 68

                #8
                Hi gobblegob,
                For your need, You add a Module in your Project file, then how many values are Inputted from Form2 are declared in the Module as your require data types in Public mode.
                Then you have to store Inputted Values to the variable which are declared in Module. Then you can close the Form2, but no data will be lost.

                If you want to get Source Code in VB6 you can contact me.

                Get Better.

                Regards,

                Shuvo

                Comment

                • jamesd0142
                  Contributor
                  • Sep 2007
                  • 471

                  #9
                  Originally posted by shuvo2k6
                  Hi gobblegob,
                  For your need, You add a Module in your Project file, then how many values are Inputted from Form2 are declared in the Module as your require data types in Public mode.
                  Then you have to store Inputted Values to the variable which are declared in Module. Then you can close the Form2, but no data will be lost.

                  If you want to get Source Code in VB6 you can contact me.

                  Get Better.

                  Regards,

                  Shuvo

                  Hey i didnt even think of this, I must say i like the idea alot.

                  Comment

                  • smartchap
                    New Member
                    • Dec 2007
                    • 236

                    #10
                    Originally posted by gobblegob
                    basically my program has 2 forms i open the second form with form2.show for input then i want to go back to form1 but i want form 2 to close

                    Thanks
                    Gobble.
                    Use following:
                    in form1 write following line to load & show form2:

                    form2.show vbmodal

                    In form2 use following line to unload it:

                    Unload Me

                    It will unload form2 and take you back to form1 from where you opened form2.

                    Comment

                    Working...