| | |
I GIVE UP, how do I modify this code to call from one form to the other and back
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2004
Posts: 3
Reputation:
Solved Threads: 0
I GIVE UP, how do I modify this code to call from one form to the other and back
0
#1 Oct 17th, 2004
I finally give up. I have here two very simple forms that (for demonstration purposes) consist of a single click button. When you click on the button, the form becomes invisible, and the other becomes visible. you can keep going back and forth till your coffee needs re-heating in the the microwave having developed a really nice thick skin!!
BUT IT DOESN'T WORK!!!!
I obviously wanna do much more than this, but what I'm trying to do is to write successfully from one form to the other and back, then a whole world of possibilities are opened up to me. I have tried many ways (hence the comments) but always get compiler errors such as
error C2512: 'datapassing::Form1' : no appropriate default constructor available
amongst others.
Using Microsoft Visual C++.NET V2003
I could manage forms untill .NET decided to manage them for me!!
Form 1
Form 2
BUT IT DOESN'T WORK!!!!
I obviously wanna do much more than this, but what I'm trying to do is to write successfully from one form to the other and back, then a whole world of possibilities are opened up to me. I have tried many ways (hence the comments) but always get compiler errors such as
error C2512: 'datapassing::Form1' : no appropriate default constructor available
amongst others.
Using Microsoft Visual C++.NET V2003
I could manage forms untill .NET decided to manage them for me!!
Form 1
C++ Syntax (Toggle Plain Text)
#pragma once #include "Form2.h" namespace datapassing { //public __gc class Form2; 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 __gc class Form1 : public System::Windows::Forms::Form { public: // TellForm2Something( Form2* pForm2 ); // void TellForm2Something( Form2* pForm2 ) // { // pForm2->make_visible(); // } Form2 *pFrm2; public: Form1(void) { InitializeComponent(); pFrm2 = new Form2; } public: void make_visible(void) { this->Visible = true; } //STANDARD INITIALISATION AND DISPOSING CODE private: System::Void button1_Click(System::Object * sender, System::EventArgs * e) { // TellForm2Something(Form2); pFrm2->Visible = true; this->Visible = false; } }; }
Form 2
C++ Syntax (Toggle Plain Text)
#pragma once #using <mscorlib.dll> using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; namespace datapassing { public __gc class Form1; public __gc class Form2 : public System::Windows::Forms::Form { public: // TellForm1Something( Form1* pForm1 ); // void TellForm1Something( Form1* pForm1 ) // { // pForm1->make_visible(); // } Form1 *pFrm1; public: Form2(void) { InitializeComponent(); pFrm1 = new Form1; } public: void make_visible(void) { this->Visible = true; } //STANDARD INITIALISATION AND DISPOSING CODE private: System::Void button1_Click(System::Object * sender, System::EventArgs * e) { pFrm1->Visible = true; //pFrm1->make_visible(); //TellForm1Something(Form1); this->Visible = false; } }; }
![]() |
Similar Threads
- Modify code created with Dreamweaver CS3, to compare two text feilds. (JavaScript / DHTML / AJAX)
- how to call another form (VB.NET)
- command button (Visual Basic 4 / 5 / 6)
- Code for Call the program in Visual Basic (Visual Basic 4 / 5 / 6)
- FileOpen Dialog without using Common Dialog Control (Visual Basic 4 / 5 / 6)
- HTML Form post to PHP? (PHP)
- How can pass backspace(go previous page)fuctionality to a button (ASP.NET)
- Help with asp form will not display contact information (ASP)
Other Threads in the C++ Forum
- Previous Thread: endless loop? not sure why, any suggestions?
- Next Thread: help with a should be easy c++ problem
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





