Hi everyone,
I'm trying to pass data to managed object arrays. In this case i got no errors also no
correct output. So what's wrong in the code below ?
Please help.
PS. This code writes " MyDataType" on textBox1 ??!
*******************
* MyDataType.h *
*******************
using namespace System;
public ref class MyDataType
{
private:
public: // all are public ok
int id;
String ^name;
MyDataType() : id(0) {}
MyDataType(int value) : id(value) {}
~MyDataType() {}
};
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
array<MyDataType ^> ^arrayObject = gcnew array <MyDataType ^> (5);
arrayObject [0] = gcnew MyDataType;
arrayObject [0]->id = 1;
arrayObject [0]->name = "nut";
// Checking any array object content
textBox1->AppendText( Convert::ToString(arrayObject[0]));
}