Error in container object not initialize

form A:

void clicked()
{
Args args = new Args();
ContainerClass conClass_Obj;
Container conSend;
FormRun formrun;
// secondParams nn =new secondParams();
str classes;
str fromdate,todate;
;

args=new args();
classes=ComboBox.valueStr();
fromdate=DateEdit.Valuestr();
todate=DateEdit1.valueStr();
// args.parm(classes);
// args.parm(fromdate.);
//args.parm(todate);
conSend = conins(conSend, 1, classes);
conSend = conins(conSend, 2,fromdate);
conSend = conins(conSend, 3, todate);
// conSend = conins(conSend, 4, “retrive hell”);
conClass_Obj = new ContainerClass(conSend);
Args.parmObject(conClass_Obj);
// new MenuFunction(menuitemdisplaystr(second), MenuItemType::Display).run(args);
args = new args(formstr(formB));
formrun = classfactory.formrunclass(args);
formrun.init();
formrun.run();
formrun.wait();
formrun.detach();
super();
}

formB:

public void init()
{ str s1,s2,s3,s4;
containerClass conClass_Obj;
container conRec;
Args args;
;
super();
args = new args();
conClass_Obj = element.args().parmObject();
conRec = conClass_Obj.value();
s1 = conpeek(conRec,1);
s2 = conpeek(conRec,2);
s3 = conpeek(conRec,3);
// s4 = conpeek(conRec,4);
info(strfmt(“Value1 = %1 , Value2 = %2 , Value3 = %3 ,Value4 = %4”,s1,s2,s3,s4));
}

Could you please start providing at least some description of your problems? You didn’t even tell us which line is throwing the error.

str classes;
str fromdate,todate;
;

args = new args(formstr(formB)); <–before
// args.parm(classes);
// args.parm(fromdate.);
//args.parm(todate);
conSend = conins(conSend, 1, “asd”);
conSend = conins(conSend, 2, “cd”);

// conSend = conins(conSend, 4, “retrive hell”);
conClass_Obj = new ContainerClass(conSend);
Args.parmObject(conClass_Obj); <–this

I’m sorry, but I can’t help until you provide some description of what you’re doing and what kind of problem you have with it. Saying “this” isn’t sufficient.

i need to pass a two date field and one enum field from FormA to FormB…So i am use the container …there is no error when i am compile… but when i run it shows error?

What exactly does the error say?

And why are you using a container? Why don’t you create a class with two date values and one enum? You’ll get a compile-time type control and code that’s much easier to read and maintain.

For example, you’ll write

MyObject myObj = new MyObject();
myObj.parmFromDate(DateEdit.dateValue());

instead of

Container conSend;
str fromdate;
fromdate=DateEdit.Valuestr();
conSend = conins(conSend, 2,fromdate);

Error:Container class object is not initialized…can u please fix it

It doesn’t make sense to me, if what you showed is your actual code. Please make sure that your form is fully compiled and then use the debugger to review the value of conClass_Obj.

And ideally get rid of the container and never use it again as an ugly and error-prone replacement of an object. X++ is an object-oriented language, so it would be nice to use it for some object-oriented programming.

i told you before

Args.parmObject(conClass_Obj);

args = new args(formstr(formB)); <–Here you are clearing args object!!

That’s clearly removes the object from args and it would fail in form B when calling at conClass_Obj.value(), but billgates claims it fails even before that, already in form A at args.parmObject(conClass_Obj).