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
#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
#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;
}
};
}