html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

Calling a Button Event from a Compiled DLL_.NET教程_编程技术

[ ] 已经帮助:人解决问题
'The Inherits Line calls the Namespace.Class inside the DLL
<%@ Page Language="VB" Inherits="ASPFreeS.MyCodeBehind" %>

<html>
<head>
<title>Calling a Button Event from a compiled DLL</title>
</head>
<body>
   <form runat="server">
    <asp:button id="btnWhatsNew" text="Add Whats new" OnClick="b1_Click" runat="server" />
</form>
</body>
</html>

  
Source VB File that gets compiled  
cpdll.vb file



Option Strict Off

Imports System
Imports System.DateTime
Imports System.Globalization
Imports System.Data
Imports System.Data.SQL
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Namespace ASPFreeS


    Public Class MyCodeBehind : Inherits Page

        Public Sub b1_Click(sender As Object , e As System.EventArgs)
             dim value1 as string = "WOW the button was clicked!"
             response.write(value1)
        End Sub
  

    End Class
End Namespace


  
Batch File to compile the DLL(This will place the dll in the /bin directory)

This creates an aspfree.dll into the bin directory!
mk.bat file to compile the .vb file

vbc /t:library /out:../bin/aspfreebuttoneventdll.dll /r:System.Web.dll /r:System.dll
/r:System.Data.dll cpdll.vb

Q5vHTML5中文学习网 - HTML5先行者学习网
Q5vHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助