how to close the parent window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karthickchain
    New Member
    • Nov 2007
    • 13

    how to close the parent window

    i am developing window application,i have to forms namely form1,form2.
    if i click the button in form1,the frm1 have to close and form2 to display
    i used form1.close(),a nd parent.close nothing is happen please reply soon
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    try using
    window.opener.c lose();
    in the child form

    Comment

    • karthickchain
      New Member
      • Nov 2007
      • 13

      #3
      Originally posted by mzmishra
      try using
      window.opener.c lose();
      in the child form
      i had tried but that is its not working

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        following code is within Form1
        [CODE=]Form2 frm2 = new Form2();
        frm2.Owner = this;
        frm2.Show();[/CODE]
        following code goes into Form2 (Form_Load event)
        [CODE=]this.Owner.Clos e();
        //this.Owner.Hide ();[/CODE]
        you will realise why i have commented the Line which Hides the owner form
        Last edited by Shashi Sadasivan; Nov 30 '07, 08:24 AM. Reason: removing spp from code tag, OP found it difficult to read

        Comment

        • karthickchain
          New Member
          • Nov 2007
          • 13

          #5
          Originally posted by Shashi Sadasivan
          following code is within Form1
          [CODE=cpp]Form2 frm2 = new Form2();
          frm2.Owner = this;
          frm2.Show();[/CODE]
          following code goes into Form2 (Form_Load event)
          [CODE=cpp]this.Owner.Clos e();
          //this.Owner.Hide ();[/CODE]
          you will realise why i have commented the Line which Hides the owner form
          please explain me full please please

          Comment

          • Shashi Sadasivan
            Recognized Expert Top Contributor
            • Aug 2007
            • 1435

            #6
            What do you not understand in what i sent?

            the code has to be put in 2 different forms
            the firt sniippet is where you call form2

            and the second snippet is inside form2 when you want to close the parent form

            Comment

            • karthickchain
              New Member
              • Nov 2007
              • 13

              #7
              Originally posted by Shashi Sadasivan
              What do you not understand in what i sent?

              the code has to be put in 2 different forms
              the firt sniippet is where you call form2

              and the second snippet is inside form2 when you want to close the parent form
              sry sir i cant able to view the code because of the font color thank u

              Comment

              • Shashi Sadasivan
                Recognized Expert Top Contributor
                • Aug 2007
                • 1435

                #8
                Well, how about copying the text , pasting it in a notepad and then trying?

                i will remove the cpp tag in it so that it appears in better contrast for you

                Comment

                • karthickchain
                  New Member
                  • Nov 2007
                  • 13

                  #9
                  thank u for ur valuable suggestion

                  Comment

                  Working...