0
votes

I am trying to use my .net image editor user control as an activeX object in a web form.

After internet search, I created a asp.net web site from VS2008 and added the following code

<object classid="res/ImageEditor.dll#ImageEditor.Editor" 
        height="400" width="400" id="myControl1" name="myControl1" > 
</object>

<INPUT id="Button1" type="button" value="Btn" name="Btn" onclick="return Button1_onclick()">

</script>
<script language=javascript>
    function Button1_onclick() {
        alert(document.getElementById("myControl1").WatermarkText);
    }
</script>

I have two problems

1-) When i first create the project i see the user control on browser but, after rebuilding the user control and changing the dll file at web site, the object no more appears on browser. Instead i see something like an error image.

2-) i can not access public properties.

The user control is marked as "make com visible", and register for com is checked at properties.

1

1 Answers

0
votes

There are quite a few hoops to jump through in order to get a .NET UserControl to behave nicely as an ActiveX.

See my answer to this previous question, on how to get it working.

To add more clarity on why you're having problems with building your UserControl, you've probably got the auto build number going in your project properties. "Hard code" the version number in the properties. As long as you don't change interface you should be fine.

N.B. You have to implement a public IDispatch interface for your properties to be accessable.