Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Instroduction
 

Code behind (VB net)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"  Inherits="FirstPageCodeBehind" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>First Page Code-Behind</title> </head> <body>     <form id="form1" runat="server">     <div>          <asp:Button         id="Button1"         Text="Click Here"         Runat="server" />          <br /><br />              <asp:Label         id="Label1"         Runat="server" />              </div>     </form> </body> </html> File: Default.aspx.vb Partial Class FirstPageCodeBehind     Inherits System.Web.UI.Page     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load         Label1.Text = "Click the Button"     End Sub     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click         Label1.Text = "Thanks!"     End Sub End Class