C++ Form Transitions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dde334
    New Member
    • May 2008
    • 5

    #1

    C++ Form Transitions

    I probably should know how to do this, but I don't. I need to make a program that uses multiple forms. Say that I have FormA, that opens when you compile, and when you push button1, it closes FormA and opens FormB.
  • Sick0Fant
    New Member
    • Feb 2008
    • 121

    #2
    Originally posted by dde334
    I probably should know how to do this, but I don't. I need to make a program that uses multiple forms. Say that I have FormA, that opens when you compile, and when you push button1, it closes FormA and opens FormB.
    Forms have a close method, and a show method. Should be pretty apparent how to use them in your handler.

    Comment

    • dde334
      New Member
      • May 2008
      • 5

      #3
      Originally posted by Sick0Fant
      Forms have a close method, and a show method. Should be pretty apparent how to use them in your handler.
      Could you post an example?

      Comment

      • dde334
        New Member
        • May 2008
        • 5

        #4
        I tried that, but the output sais that FormB is an undeclared identifier. Is there some sort of declaration that I need, or am I doing is wrong?
        Code:
         Show(Project::FormB);
        Last edited by dde334; May 15 '08, 08:47 PM. Reason: wrong titles

        Comment

        • Sick0Fant
          New Member
          • Feb 2008
          • 121

          #5
          Originally posted by dde334
          I tried that, but the output sais that FormB is an undeclared identifier. Is there some sort of declaration that I need, or am I doing is wrong?
          Code:
           Show(Project::FormB);
          No. Use formB's Show method, not the current instance's.

          Code:
          FormB ^ MyFormB = gcnew FormB;
          MyFormB->Show();
          this->Close();

          Comment

          • dde334
            New Member
            • May 2008
            • 5

            #6
            Originally posted by Sick0Fant
            No. Use formB's Show method, not the current instance's.

            Code:
            FormB ^ MyFormB = gcnew FormB;
            MyFormB->Show();
            this->Close();
            Thanks, but when I am editing FormA, it wont work when I try to make it open FormB. Is there some other type of declaration, or something I need to do to FormB? They are both in the same project.

            Comment

            • Sick0Fant
              New Member
              • Feb 2008
              • 121

              #7
              Originally posted by dde334
              Thanks, but when I am editing FormA, it wont work when I try to make it open FormB. Is there some other type of declaration, or something I need to do to FormB? They are both in the same project.
              Could you be a bit more specific? Does it not compile? Does it run, but not the way you thought it would?

              Comment

              • dde334
                New Member
                • May 2008
                • 5

                #8
                It doesnt compile, and the error says FormB: undeclared identifier.

                Comment

                • Sick0Fant
                  New Member
                  • Feb 2008
                  • 121

                  #9
                  Originally posted by dde334
                  It doesnt compile, and the error says FormB: undeclared identifier.
                  Did you declare your "FormB" object like I did? I confirmed that the way I declared the form works. Something tells me that either the way you declared it wasn't correct, or else it's out of scope by the time you try to use it's method. You should be placing the code I gave you in the event method of FormA which will open FormB.

                  Comment

                  Working...