vendredi 10 avril 2015

Creating Class with ^form

I have main window, wich creates many identical forms, and i need to close them all. I want to create Class with method Close and form in it. After that put this into vector, and when i need to close all forms, in cicle i use method close.


First i do this:


class header



#pragma once
#include "InstrumentForm.h"
class SubscribedItem
{
public:
SubscribedItem();
~SubscribedItem();
void Close();
private:
InstrumentForm ^x; // Here i have problem
};


then i do this:



#pragma once
#include "InstrumentForm.h"
ref class SubscribedItem
{
public:
SubscribedItem();
~SubscribedItem();
void Close();
private:
InstrumentForm ^x; // Here i have problem
};


then i do this:



#pragma once

using namespace std;

namespace Client //namespase of my application, that includes InstrumentForm
{
ref class SubscribedItem
{
public:
SubscribedItem();
~SubscribedItem();
private:
InstrumentForm ^x; //c2143
};
}


but after that, i have error c2143


And if i add #include "InstrumentForm.h" in last variant, a have errors in InstrumentForm.h


How can i add form into the class without problems?


Aucun commentaire:

Enregistrer un commentaire