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. C / C++ / MFC
  4. loading a new Form (MS vc++ 2005)

loading a new Form (MS vc++ 2005)

Scheduled Pinned Locked Moved C / C++ / MFC
11 Posts 5 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.
  • L luhfluh

    Hi to all, I'm new to vc++ and I've read a bit on how to create a new form and load it (make it appear on screen). But i have this code and its corresponding error and would be glad if someone could point me in the right direction. There's three forms, Form1 (login form) and gymMain a main interface. So what I tried to do is first load the application with gymMain and make its Visible state FALSE, next load Form1 (login) and upon confirmation of input, close Form1 and make gymMain visible. Now I try this with the below code and the erorr is shown below. All help/suggestions appreaciated. regards PS: I'm prety sure I used the header files appropriately but one never knows, ...:doh: -------------------------- code for Main application: -------------------------- // GymManager.cpp : main project file. #include "stdafx.h" #include "Form1.h" #include "gymMain.h" #include "NewMember.h" #include "search.h" using namespace GymManager; //using namespace Form1; //using namespace gymMain; //using namespace NewMember; //using namespace search; [STAThreadAttribute] int main(array ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew gymMain()); return 0; } ---------------------------------------- code for gymMain: ---------------------------------- #pragma once #include "NewMember.h" #include "Form1.h" using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Globalization; using namespace GymManager; namespace GymManager { /// /// Summary for gymMain /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public ref class gymMain : public System::Windows::Forms::Form { public: gymMain(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean u

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #2

    luhfluh wrote:

    c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2039: 'Form1' : is not a member of 'GymManager'

    The compiler is telling you exactly what is wrong. C2039


    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

    "Judge not by the eye but by the heart." - Native American Proverb

    1 Reply Last reply
    0
    • L luhfluh

      Hi to all, I'm new to vc++ and I've read a bit on how to create a new form and load it (make it appear on screen). But i have this code and its corresponding error and would be glad if someone could point me in the right direction. There's three forms, Form1 (login form) and gymMain a main interface. So what I tried to do is first load the application with gymMain and make its Visible state FALSE, next load Form1 (login) and upon confirmation of input, close Form1 and make gymMain visible. Now I try this with the below code and the erorr is shown below. All help/suggestions appreaciated. regards PS: I'm prety sure I used the header files appropriately but one never knows, ...:doh: -------------------------- code for Main application: -------------------------- // GymManager.cpp : main project file. #include "stdafx.h" #include "Form1.h" #include "gymMain.h" #include "NewMember.h" #include "search.h" using namespace GymManager; //using namespace Form1; //using namespace gymMain; //using namespace NewMember; //using namespace search; [STAThreadAttribute] int main(array ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew gymMain()); return 0; } ---------------------------------------- code for gymMain: ---------------------------------- #pragma once #include "NewMember.h" #include "Form1.h" using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Globalization; using namespace GymManager; namespace GymManager { /// /// Summary for gymMain /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public ref class gymMain : public System::Windows::Forms::Form { public: gymMain(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean u

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #3

      This question would be best answered MC++/CLI[^] forum.

      luhfluh wrote:

      c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2039: 'Form1' : is not a member of 'GymManager'

      Your problem is not about headers, but I think you are relating Form1 with wrong namespace.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      L 1 Reply Last reply
      0
      • L luhfluh

        Hi to all, I'm new to vc++ and I've read a bit on how to create a new form and load it (make it appear on screen). But i have this code and its corresponding error and would be glad if someone could point me in the right direction. There's three forms, Form1 (login form) and gymMain a main interface. So what I tried to do is first load the application with gymMain and make its Visible state FALSE, next load Form1 (login) and upon confirmation of input, close Form1 and make gymMain visible. Now I try this with the below code and the erorr is shown below. All help/suggestions appreaciated. regards PS: I'm prety sure I used the header files appropriately but one never knows, ...:doh: -------------------------- code for Main application: -------------------------- // GymManager.cpp : main project file. #include "stdafx.h" #include "Form1.h" #include "gymMain.h" #include "NewMember.h" #include "search.h" using namespace GymManager; //using namespace Form1; //using namespace gymMain; //using namespace NewMember; //using namespace search; [STAThreadAttribute] int main(array ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew gymMain()); return 0; } ---------------------------------------- code for gymMain: ---------------------------------- #pragma once #include "NewMember.h" #include "Form1.h" using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Globalization; using namespace GymManager; namespace GymManager { /// /// Summary for gymMain /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public ref class gymMain : public System::Windows::Forms::Form { public: gymMain(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean u

        J Offline
        J Offline
        James R Twine
        wrote on last edited by
        #4

        Yep - comparing that code to the stuff I have had to write in the past to do something similar with good old MFC, I can see the improvement...    Yep!  Gotta love progress... :)    Peace!

        -=- James
        Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        See DeleteFXPFiles

        1 Reply Last reply
        0
        • P prasad_som

          This question would be best answered MC++/CLI[^] forum.

          luhfluh wrote:

          c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2039: 'Form1' : is not a member of 'GymManager'

          Your problem is not about headers, but I think you are relating Form1 with wrong namespace.

          Prasad Notifier using ATL | Operator new[],delete[][^]

          L Offline
          L Offline
          luhfluh
          wrote on last edited by
          #5

          tks for ur help. bt I tried using something like below (without the GymManager namespace) and it still provded an error that said "undeclared identifier Form1" alternative code tried: ----------------------- Form1 ^login= gcnew Form1(); login->Show();

          P 1 Reply Last reply
          0
          • L luhfluh

            tks for ur help. bt I tried using something like below (without the GymManager namespace) and it still provded an error that said "undeclared identifier Form1" alternative code tried: ----------------------- Form1 ^login= gcnew Form1(); login->Show();

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #6

            You need to use name of namespace Form1 is member of, clearly I could not see class Form1's definition in your code.

            Prasad Notifier using ATL | Operator new[],delete[][^]

            L 1 Reply Last reply
            0
            • P prasad_som

              You need to use name of namespace Form1 is member of, clearly I could not see class Form1's definition in your code.

              Prasad Notifier using ATL | Operator new[],delete[][^]

              L Offline
              L Offline
              luhfluh
              wrote on last edited by
              #7

              tks for ur reply. bt i'm still lost if u know wat i mean, If u can provide a sample code of how to use wat u r talking about it would be very helpful... I dont know where exactly in Form1's definition i would need to put the namespace (besides I'm new to this managed c++ stuff - work better with Java) Tks for ur help once again.

              P 1 Reply Last reply
              0
              • L luhfluh

                tks for ur reply. bt i'm still lost if u know wat i mean, If u can provide a sample code of how to use wat u r talking about it would be very helpful... I dont know where exactly in Form1's definition i would need to put the namespace (besides I'm new to this managed c++ stuff - work better with Java) Tks for ur help once again.

                P Offline
                P Offline
                prasad_som
                wrote on last edited by
                #8

                luhfluh wrote:

                tks for ur reply. bt i'm still lost if u know wat i mean, If u can provide a sample code of how to use wat u r talking about it would be very helpful...

                Just take a simple form application

                namespace TestForm {

                using namespace System;
                using namespace System::ComponentModel;
                using namespace System::Collections;
                using namespace System::Windows::Forms;
                using namespace System::Data;
                using namespace System::Drawing;
                
                public ref class Form1 : public System::Windows::Forms::Form
                {
                public:
                	Form1(void)
                	{
                		InitializeComponent();
                		//
                		//TODO: Add the constructor code here
                		//
                	}
                         //code commented for clarity
                };
                

                }

                In above example TestForm is a namespace and Form1 is class.

                luhfluh wrote:

                I dont know where exactly in Form1's definition i would need to put the namespace

                You are getting it wrong. Class will be member of namespace.

                luhfluh wrote:

                (besides I'm new to this managed c++ stuff - work better with Java)

                I'm there is similar concept in Java.

                Prasad Notifier using ATL | Operator new[],delete[][^]

                L 1 Reply Last reply
                0
                • L luhfluh

                  Hi to all, I'm new to vc++ and I've read a bit on how to create a new form and load it (make it appear on screen). But i have this code and its corresponding error and would be glad if someone could point me in the right direction. There's three forms, Form1 (login form) and gymMain a main interface. So what I tried to do is first load the application with gymMain and make its Visible state FALSE, next load Form1 (login) and upon confirmation of input, close Form1 and make gymMain visible. Now I try this with the below code and the erorr is shown below. All help/suggestions appreaciated. regards PS: I'm prety sure I used the header files appropriately but one never knows, ...:doh: -------------------------- code for Main application: -------------------------- // GymManager.cpp : main project file. #include "stdafx.h" #include "Form1.h" #include "gymMain.h" #include "NewMember.h" #include "search.h" using namespace GymManager; //using namespace Form1; //using namespace gymMain; //using namespace NewMember; //using namespace search; [STAThreadAttribute] int main(array ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew gymMain()); return 0; } ---------------------------------------- code for gymMain: ---------------------------------- #pragma once #include "NewMember.h" #include "Form1.h" using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Globalization; using namespace GymManager; namespace GymManager { /// /// Summary for gymMain /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public ref class gymMain : public System::Windows::Forms::Form { public: gymMain(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean u

                  P Offline
                  P Offline
                  Programm3r
                  wrote on last edited by
                  #9

                  Wouldn't the above code snippet qualify as CLI?? Anyway ... just asking :jig: Regards,


                  The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
                  My Blog: ^_^

                  P 1 Reply Last reply
                  0
                  • P prasad_som

                    luhfluh wrote:

                    tks for ur reply. bt i'm still lost if u know wat i mean, If u can provide a sample code of how to use wat u r talking about it would be very helpful...

                    Just take a simple form application

                    namespace TestForm {

                    using namespace System;
                    using namespace System::ComponentModel;
                    using namespace System::Collections;
                    using namespace System::Windows::Forms;
                    using namespace System::Data;
                    using namespace System::Drawing;
                    
                    public ref class Form1 : public System::Windows::Forms::Form
                    {
                    public:
                    	Form1(void)
                    	{
                    		InitializeComponent();
                    		//
                    		//TODO: Add the constructor code here
                    		//
                    	}
                             //code commented for clarity
                    };
                    

                    }

                    In above example TestForm is a namespace and Form1 is class.

                    luhfluh wrote:

                    I dont know where exactly in Form1's definition i would need to put the namespace

                    You are getting it wrong. Class will be member of namespace.

                    luhfluh wrote:

                    (besides I'm new to this managed c++ stuff - work better with Java)

                    I'm there is similar concept in Java.

                    Prasad Notifier using ATL | Operator new[],delete[][^]

                    L Offline
                    L Offline
                    luhfluh
                    wrote on last edited by
                    #10

                    tks, bt i think i'm just in the right frame of mind to grasp where to include it...The namespace GymManager is already defined in Form1's header, and within it there is the

                    prasad_som wrote:

                    public ref class Form1 : public System::Windows::Forms::Form

                    details and so it is for all the other forms. So with what I understand from ur explaination the class within the namespace should be called without problems if only it is within the namespace.

                    prasad_som wrote:

                    I'm there is similar concept in Java.

                    interfaces or abstract classes are there yes, and are similarly defined and used. but I cant get ma head around this. tks anyway.

                    1 Reply Last reply
                    0
                    • P Programm3r

                      Wouldn't the above code snippet qualify as CLI?? Anyway ... just asking :jig: Regards,


                      The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
                      My Blog: ^_^

                      P Offline
                      P Offline
                      prasad_som
                      wrote on last edited by
                      #11

                      What happens to your problem here[^] . Interesting to see, does your prblem was same as guessed

                      Prasad Notifier using ATL | Operator new[],delete[][^]

                      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