loading a new Form (MS vc++ 2005)
-
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
-
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
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
-
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
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[][^]
-
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
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 -
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[][^]
-
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();
You need to use name of namespace
Form1
is member of, clearly I could not see classForm1's
definition in your code.Prasad Notifier using ATL | Operator new[],delete[][^]
-
You need to use name of namespace
Form1
is member of, clearly I could not see classForm1's
definition in your code.Prasad Notifier using ATL | Operator new[],delete[][^]
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.
-
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.
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 andForm1
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[][^]
-
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
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: ^_^ -
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 andForm1
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[][^]
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.
-
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: ^_^What happens to your problem here[^] . Interesting to see, does your prblem was same as guessed
Prasad Notifier using ATL | Operator new[],delete[][^]