I am trying to use an ActiveX TreeView in SAP Business One form.
Even though I follow the example provided in the Business One SDK help, it doesn't work at all and I get a COM exception early in the code:
Item oItem = Form.Items.Add("xml", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X); oItem.Visible = true; oItem.Top = 5; oItem.Left = 5; oItem.Width = 290; oItem.Height = 490; ActiveX AcXTree = oItem.Specific; AcXTree.ClassID = "MSComctlLib.TreeCtrl.2"; MSComctlLib.TreeView2 treeView = AcXTree.Object;//EXCEPTION
Exception:System.Runtime.InteropServices.COMException wurde nicht von Benutzercode behandelt.
Message=Beim Aufruf einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben.
Source=EGR_IQone
ErrorCode=-2147467259
StackTrace:
bei SAPbouiCOM.IActiveX.get_Object()
I also tried using the ActiveX TreeView class guid {C74190B4-8589-11D1-B16A-00C0F0283628} but I get the same result.
I use Windows 7 64Bit and successfully registered MSComctl.ocx. I already asked on the SAP forum but did not get any answers so far.
And is there a way to tell what went wrong? Apparently E_FAIL is a general failure and it tells me nothing.
Thanks.