In coding, it is undeniable that calling active will bring great convenience to programming, although Microsoft does not only require. Net to call active components.
This example is an example of calling the active component on a simple web page. Data is transmitted and displayed in the control of the active component.
The instance code is as follows:
1. Create an active component (. net c # is used here)
(In this program: Create a class library, add component classes, and place the following labels, buttons, and groupbox)
Note that. before using the DLL, you must install the SDK in assemblyinfo of the class library. add using system to CS. security; and the attribute [Assembly: allowpartiallytrustedcallers ()] to give the control sufficient permissions for display on the page.
Using system;
Using system. componentmodel;
Using system. collections;
Using system. diagnostics;
Using system. Windows. forms;
}
}
}
2. Call the active component on the web page
Note that when calling a Web page, you need to put active. dll under the WEB virtual directory.
<HTML>
<Head>
<Title> testactive </title>
<Meta name = "generator" content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "code_language" content = "C #">
<Meta name = "vs_defaultclientscript" content = "JavaScript">
<Meta name = "vs_targetschema" content = "http://schemas.microsoft.com/intellisense/ie5">
</Head>
<Body>
<Font face = "Arial" size = "1">
<Object ID = "mycontrol1" name = "mycontrol1" classid = "http: // localhost/webapplication1/activexdotnet. dll # activexdotnet. abeencontrol"
Width = "288" Height = "72" viewastext>
</Object>
</Font>
<Form ID = "frm" name = "frm">
<Input type = "text" name = "TXT" value = "Enter data:" id = "text1">
<Input type = "button" value = "OK" onclick = "doscript ();" id = "button1" name = "button1">
<SCRIPT type = "text/JavaScript">
Function doscript ()
{
Mycontrol1.labeltext=frm.txt. value;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.