on 05-17-2006 9:01 PM
I tried the VB.NET ActiveX sample and I get a System.Runtime.InteropServices.COMException "The server threw an exception" when it tries to set the ClassID property. I checked my registry and the class is regestered. Why would the sample program not work (I'm on B1 2005)?
Hi Ben,
we use ActiveX with C# on 2005A and it works fine. He some sample code to assign the control:
In the sample we use 2 Controls (binding at controlItem and sourceItem) which communicate with each other:
In the form-defining XML we have something like this:
<items>
<action type="add">
....
<Item description="" disp_desc="0" enabled="1" from_pane="0" height="0" left="0" linkto="" right_just="0" tab_order="0" to_pane="0" top="0" type="102" uid="_source" visible="0" width="0" forecolor="-1">
<AutoManagedAttribute/>
<specific classid="MySource"/>
</Item>
<Item description="" disp_desc="0" enabled="1" from_pane="0" height="400" left="5" linkto="" right_just="0" tab_order="3" to_pane="0" top="5" type="102" uid="_control" visible="1" width="520" forecolor="-1">
<AutoManagedAttribute/>
<specific classid="MyControl"/>
</Item>
...
</action>
</items>
In the code like this:
virtual protected void _initActiveX() {
SAPbouiCOM.Item sourceItem = form.Items.Item("source");
SAPbouiCOM.Item controlItem = form.Items.Item("control");
controlItem.SetAutoManagedAttribute(SAPbouiCOM.BoAutoManagedAttr.ama_Visible, 0,
SAPbouiCOM.BoModeVisualBehavior.mvb_True);
SAPbouiCOM.ActiveX axSource = (SAPbouiCOM.ActiveX)sourceItem.Specific;
SAPbouiCOM.ActiveX axControl = (SAPbouiCOM.ActiveX)controlItem.Specific;
_control = (MyControl)axControl.Object;
_control.MySource = (MySource)axSource.Object;
}
I hope this will help you.
Greetings from Berlin
Gerd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like it can work on another machine here. But it doesn't work on my machine. I tried a different control and it seems to work on both machines. I suspect that there is just a problem with the treeview control license or something. In VB, you have to use Licenses.Add in order to add a control to a form. I wonder how B1 manages the license. It looks like it gets the license by adding a reference to MSCOMCTL.OCX. I tried removing and re-adding the reference, but I cannot re-add the reference because when I try to reference MSCOMCTL.OCX, I end up with a reference to C:\WINDOWS\assembly\GAC\mscomctl\10.0.4504.0__31bf3856ad364e35\mscomctl.dll instead. I think Microsoft provided a custom wrapper for this control. Could that be interfering with the proper operation of the sample?
Somehow I also got this message after editing the code a bit to conform to the new reference:
"One or more custom wrappers for COM components have been installed onyour machine after you added references to those COM components. These wrappers may provide additional capabilities not offered by the auto-generated wrappers currenty in use.
Do you want to replace the auto-generated wrappers with the custom wrappers?"
Message was edited by: Ben Marty
Treeview control doesn't work with XP SP2.
If you downgrade your system to SP1 samples work well.
I have the same problem and I can't find a solution.
Maybe third party ActiveX are better.
Hope it helps
Bye
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ben,
Did you try to use the activeX control in a normal VB.Net project?
Regards
Ad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.