IcinitiBrad
Programmer
Hi,
I'm trying to compose Accpac views in JSharp.NET using the AccpacCOMAPI and nothing I do seems to allow me to do this. I keep getting the following compile time error:
Cannot pass object of type 'AccpacCOMAPI.AccpacView[]' as parameter of type 'byref Object'.
Here's the code. It's using the views from a 3rd party application, but I get the same compile time error trying to use Accpac's own views.
Code:
try
{
AccpacCOMAPI.AccpacSessionClass sess = new AccpacCOMAPI.AccpacSessionClass();
AccpacCOMAPI.AccpacDBLink dblink = null;
AccpacCOMAPI.AccpacView vw_VMDH = null;
AccpacCOMAPI.AccpacView vw_VMDT = null;
sess.Init( "", "VM", "VM0000", "52A" );
sess.Open( "ADMIN", "ADMIN", "VML52A", System.DateTime.get_Now(), 0, "" );
dblink = sess.OpenDBLink( AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY,
AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE );
dblink.OpenView( "VM0050", vw_VMDH );
dblink.OpenView( "VM0060", vw_VMDT );
AccpacCOMAPI.AccpacView[] arrViews =
{
vw_VMDT,
vw_VMDTPH,
};
[COLOR=RED]
// *** This is where the compiler chokes. ***
vw_VMDH.Compose( arrViews );[/COLOR]
vw_VMDH.Init();
vw_VMDH.set_Order( 0 );
vw_VMDH.Browse( "", true );
if( !vw_VMDH.Fetch() )
Out( "Fetch returned: false" );
while( vw_VMDH.Fetch() )
{
String strLine = vw_VMDH.get_Fields().get_FieldByName("TXDOCID").get_Value().ToString();
Out( strLine );
}
vw_VMDT.Close();
vw_VMDTPH.Close();
dblink.Close();
sess.Close();
}
catch( System.Exception x )
{
// Some code.
}
I have also tried doing this directly with the XAPI classes and everything compiles, but the views don't get composed at runtime.
Any ideas would be appreciated.
~Brad