>Partial Class Default2 > Inherits System.Web.UI.Page > > Function increment_counter() As Integer > Static iCounter As Integer = 0 > iCounter = iCounter + 1 > Return iCounter > End Function > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click > Label1.Text = increment_counter() > End Sub >End Class >>
>< %@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> > >< !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 runat="server"> > < title>< /title> >< /head> >< body> > < form id="form1" runat="server"> > < div> > > < /div> > < asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> > > < asp:Button ID="Button1" runat="server" Text="Button" /> > < /form> >< /body> >< /html>>