lundi 7 décembre 2015

How to access and use SAPbobsCOM assembly through coding on target .NET framework 3.5 C#

i want to access SAPbobsCOM assembly through code and use its attributes and method, my target .NET framework is '3.5'. here is a snippet that i am sharing:

Type Atype = Type.GetTypeFromProgID("SAPbobsCOM.Company");

object oCompany = Activator.CreateInstance(Atype);


PropertyInfo UT = Atype.GetType().GetProperty("UseTrusted");

UT.SetValue(oCompany, false, null);

PropertyInfo language = Atype.GetProperty("language");

language.SetValue(oCompany, 3, null);

i have tried to use GetType() as well as GetTypeFromProgID() on line no. 1 but both the methods return NULL everytime. PS: my target .NET framework is 3.5





Aucun commentaire:

Enregistrer un commentaire