Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Basic Script Access to Windows Form Controls In IE
 

Basic Script Access to Windows Form Controls In IE


So, I'm getting my feet wet with hosting controls in IE, and as a simple test I'm just trying to get access to a simple function to change the text of a label in the control from a standard html button hooked to a javascript function. I created a basic control library in VS.Net 2005, added my label, and added a public function to the class defintion as follows:

public void changeLabel() {
lblStatus.Text= "Changed";
}

I've compiled the control and embedded it into the following html file:

<html>
<head>
<script language="javascript">
function doit() {
change1.changeLabel();
}
</script>
</head>
<body>
<p>Simple Example<br /> <br />
<input type="button" onclick="doit();" value="Push Me"/>
</body>
<object id="change1"
classid="http:change.dll#change.change"
height="500" width="500">
</object>
</html>

When I view the page, the control loads as expected, but when I press the button, I get an error that says the object doesn't support the method. I've seen some other examples online (although very few) which seem to indicate that adding script access to the controls should be as easy as defining the public method and calling it. Obviously, I'm doing something wrong, because this should be a fairly simple exercise. Any help or suggestions would be greatly appreciated.

Thanks in Advance,

-Erik Taylor
Erik Taylor  Tuesday, February 28, 2006 9:09 AM
Figured it out:

You have to check 'Make Assembly COM Visible' for its methods to be script accessible. Sigh.

Erik Taylor  Wednesday, March 01, 2006 9:10 AM

You can use google to search for other answers

Custom Search

More Threads

• Deference B/W Application Setting & Config Files.
• ClickOnce and plugin directories
• How to change SourcePath dynamicly
• clickonce deployment downloads frozen
• Difficulty with deployment project, multiple users cannot use application
• Can I prevent app from running if can't get update?
• ClickOnce Publishing Issues after RenewCert
• Windows Service EXE with shortcut
• To Create Patch file or setup project
• Problem in deploying the vb.net application.