2
Answers

Run .NET ActiveX control on IE 7.0 machine that doesnt have .NET installed on it.

datta kale

datta kale

15y
3.2k
1
I created a DLL (class library) on C#.NET (2005) and want
to use it as an ActiveX control on a web page (html).
I have checked the box for Make "assembly COM visible" in the
project properties before I build the DLL. Code does do much,

here is my C# code for ctrl

namespace MyActiveXctrlLib
{
    public partial class MyUserCtrl : UserControl
    {
        public string setName
        {
            set
            {
                txtName.Text = value;
            }
        }
        public MyUserCtrl()
        {
            InitializeComponent();
        }
    }
}

here is my HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
     <OBJECT id="myControl1" name="myControl1" classid="MyActiveXctrlLib.dll#MyActiveXctrlLib.MyUserCtrl" width=288 height=50>
     </OBJECT>
    <form name="frm" id="frm">
                <input type="text" name="txt" value="Enter your name here">
                    <input type=button value="Click me" onClick="doScript();"></td>
    </form>

</body>
<script language="javascript">
    function doScript()
     {
          myControl1.setName = frm.txt.value;
     }
</script>
</html>



on button click doScript(); is executed .
it sets the setName property of myControl1 i.e. WinForm control.

this code working successfully on IE 7.0 machine having .NET installed on them
but is not working on Machine those dnt have .NET installed on them.

not checked on IE 6.0.

Thanks in advance .
DaTtA
[email protected]
Answers (2)