.NET Framework Bookmark and Share   
 index > JScript for the .NET Framework > How to access the value from Activex control
 

How to access the value from Activex control

Hi,
I have a windows application which project out put is class library. In that i have a text box and button. I created a property with the name -UIDwhich is public and returns textbox value.
Now i ve taken webapplication and i added theDLL to the application. in JScript file here the method.
function GetWindowCtrl()
{

document.write(

'<object id="windowCtrl" name="windowCtrl" height="200" width="200" classid="WindowsFormsSmartCardDLL.dll#WindowsFormsSmartCardDLL.SmartCardTest" VIEWASTEXT/>');

}

i'm calling the method in webpage.

<

div align="center">

<input id="Button2" type="button" onclick="return doMySubMit();" value="button" />

</div>

<div>

<script language="javascript">GetWindowCtrl(); </script>

</

</

div>

<

script language="javascript" >

function doMySubMit()

{

var MyAx=document.forms[0].windowCtrl;

//alert(MyAx.UID);

//var MyAx =new ActiveXObject("WindowsFormsSmartCardDLL.SmartCardTest");

alert(MyAx.UID);

return false;

}

</

script>


Itz displaying on webpage.There is no issue in it.
Now when i click on button it should give me the text box value.Here im facing the problem.im not able to retrive the textbox value.
Active codewhich i displayed isgiving me 'undefined' .
when i call through Activexobject("WindowsFormsSmartCardDLL.SmartCardTest");
itz giving me an error like 'Automation server can't create object.'
can any one please solve my problem.

Thanks and Regards,
NagarjunaDilip.

NagarjunaDilip
I solved my problem........i need to set in class library --->Assemblyinfo file---->by default it is false and make it to true. Now problem is solved.

[

assembly: ComVisible(true)]



Any way thanks 4 replying.......

Regards,
Dilip

NagarjunaDilip
There is a good post http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx.
Rohit S
I solved my problem........i need to set in class library --->Assemblyinfo file---->by default it is false and make it to true. Now problem is solved.

[

assembly: ComVisible(true)]



Any way thanks 4 replying.......

Regards,
Dilip

NagarjunaDilip

You can use google to search for other answers

Custom Search

More Threads

• JavaScript compression.
• XMLHTTP file size limit ?
• inharitance in javascript
• VSA: How to get notified about JScript runtime exceptions?
• Where the J2EE Application Server Stands in the Scheme of Things
• .Net 1.1 Windows control vs .NET 2.0
• Passing parameters and Relative coordinates in JScript
• Page not working in IE 7(Multiple tabs opened)
• jaVascript
• Syntax to pass the value of a textbox from an edittemplate to a javascript function