views:

119

answers:

2

Hi, I'm Writing a C++ Class. I want to keep a global variable in System::Windows::Form::Control type or a .NET managed objects. I want to process somethink on this global variable. But Visual C++ is not allowed this.

Returning Error is: "global or static variable may not have managed type"

May be this error interest Garbage Collector.

How I solve this problem?

A: 

use a non managed type like std::string

rerun
A: 

For a control, you could store the Handle (HWND) in your global variable and get the control back when you need it. For other managed objects, I don't know. Do they have an identifier that allows doing the same thing ?

Timores