The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
How to return complex type from .NET Extension Form -- HELP
Posted: 30 Jul 09 2:12 PM
|
I created a class wich calls a form in C#. When the form closes I want to return to SLX an object.
SLX fails with the error: "Object required: 'Application.Managed.Run(...)'" at set Result = Application.Managed.Run(ext, args)
If the class returns a simple type it works fine.
-------------------------------- C# Code --------------------------------
class SLXORDER // this is what I want to return to SLX { public string RA_ID; public string NS_ID; public string JOB_ID; public string LoanerNS_ID; public string LoanerRA_ID;
}
class SLX : Sage.SalesLogix.NetExtensions.IRunnable { private Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication _SLXApplication;
public void Initialize(Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication SLXApp, Sage.SalesLogix.NetExtensions.Licensing.ILicenseKeyManager LicenseKeyManager) { _SLXApplication = SLXApp; }
public object Run(object[] Args) { frmPostRMA RMAForm = new frmPostRMA(); RMAForm.RMA_Type = Args[0].ToString(); .... RMAForm.ALLOWED_SHOT_COUNT = Args[9].ToString();
RMAForm.ShowDialog(); SLXORDER objOrder = new SLXORDER(); objOrder.RA_ID = "3333"; objOrder.NS_ID = "2222"; objOrder.JOB_ID = "11111"; objOrder.LoanerNS_ID = "44444"; objOrder.LoanerRA_ID = "55555";
//return "Success" -- returns value to SLX correctly return objOrder; -- fails object required
}
----------------------------------------------SLX Code -------------------------------------- Dim ext Dim args(9)
ext = Application.Managed.Create("Pmt_Svc_PostRMA", "Pmt_Svc_PostRMA.SLX") args(0) = "Repair" 'RMA_Type ... args(9) = txtAllowedShotCount.Text 'ALLOWED_SHOT_COUNT
' run it (and pass any arguments) dim Result ' Result = Application.Managed.Run(ext, args) //returns string OK set Result = Application.Managed.Run(ext, args)
' destroy the loaded .NET Extension Application.Managed.Destroy ext
|
|
|
| |
| |
|
Re: How to return complex type from .NET Extension Form -- HELP
Posted: 31 Jul 09 9:12 AM
|
When you created your Class for COM, are you able to instantiate it from VB Script just by using "CreateObject"? That would tell you if the Class is properly setup for COM.
Now, as far as returning it over to SLX, I am not sure if you need to do any custom Marshalling. I have not tried to do what you are doing, but just wanted to point out that if your object wasn't COM Visible it had no chance of running on VB Script.
|
|
|
|