Hello. All i am having trouble with using public ref classes and gcnew. The following code will show you my situation.
Vector2 class
/// </summary>
public ref class vector2{
public:
vector2(void):x(""),y(""){};
System::String ^x;
System::String ^y;
void Position(System::String ^ X, System::String^ Y){
x=X;
y=Y;
};
};
Add picture class
public ref class AddPicture {
public:
AddPicture(void):fileName(""){}
vector2 ^ V1,^ V2;
System::String ^ fileName;
void newAddPicture(vector2 ^ v1,vector2 ^ v2,System::String ^ filename){
fileName = filename;
V1=v1;
V2=v2;
}
then this is where construct these
this->newAp = gcnew AddPicture();
vector2 ^vv1,^vv2;
vv1= gcnew vector2();
vv2= gcnew vector2();
vv1->Position(posx,posy);
vv2->Position(sizex,sizey);
newAp->newAddPicture(vv1,vv2,MyString1);
if i want to access newAp->V1->x;
or y an error shows up that says null reference exception unhandled. I cant figure it out, i dont know how to use ref class's can anyone tell me how to access these kinda of classes like im trying to above.thanks