Problem with global variable in visual c++ 2008
Mar 13, 2012 at 11:43pm UTC
Hi,
i try to make some windows form aplication and i cant to get on global variable with managed type. I found some solution on :
http://msdn.microsoft.com/en-us/library/by40z94e(v=vs.90).aspx but it didnt fix my problem. Now it dont know the variable myList. My code(only parts):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
ref class GlobalObjects {
public :
static ArrayList^ myList = gcnew ArrayList;
};
...
...
...
//then on mouse down
private : System::Void pictureBox1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
Point current = Point(e->X,e->Y);
myList->Add("hello" );
}
//error log:
//error C2065: 'myList' : undeclared identifier
//error C2227: left of '->Add' must point to class/struct/union/generic type
Please, can someone help me?
Mar 14, 2012 at 1:21pm UTC
Best to post .net questions @ the MSDN Forums.
Topic archived. No new replies allowed.