Public Shared Test1 As Integer = 0
Public t As New Timer
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
t = New Timer
AddHandler t.Elapsed, AddressOf OnTimedEvent
t.Interval = "5000"
t.Enabled = True
End If
End Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
If Test1 = 3 Then
t.Enabled = False
Else
Test1 += 1
End If
context.Response.Write("<h1>" & Test1 & "</h1>")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
context.Response.Write("<h1>" & Test1 & "</h1>")
End Sub