I have tried to delare the List Incr outside the if-statment and then inside the if-statement I declare a new instance of the List but when doing this I get a compilerror that says:


left of '.Add' must have class/struct/union

List<int>^ Incr;


if( textBox1->Text != "" )
{

	Incr = gcnew List<int>;
	//Add element
	Incr.Add(1);

}

>Incr.Add(1);
You use the arrow operator to access members of managed references:

Incr->Add(1);

Ah ofcourse, Thank you Narue.. I confused it with C#

/L

>Incr.Add(1);
You use the arrow operator to access members of managed references:

Incr->Add(1);