You probably faced that the variable showed all the time the same value.
ASp.NET Page class is recreated for every request and therefore normal
members do not persist over the postbacks. You'd need to ViewState to
persist values between postbacks. Example:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim intValue As Integer = 0
If Not ViewState("intValue") Is Nothing Then
intValue = CInt(ViewState("intValue"))
End If
intValue += 1
ViewState("intValue") = intValue
Response.Write("Value of the variable is:" & intValue.ToString())
End Sub