0

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);

}
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Lukezzz
0

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

Incr->Add(1);
0

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);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.