•      Powered by
 

Calling a Button Event from a Compiled DLL

.NET makes doing real code development so easy.  This simple example allows to call a button event from a Compiled DLL (Business Object).   This could either be done from a Code behind form too.

 

Click here for the Demo

Webpage code

'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

 

tio

Terms of Use | Privacy Statement ©2005-2006 IISLogs.com. All rights reserved - Powered by IIS7 - info @ www.IIS.net