Hi all,

I have a problem with incrementing and decrementing 'G_Index' global variable. Here is my 'default.aspx.vb' page code:

Imports System
Imports System.IO
Imports System.Data

Partial Class _Default
Inherits System.Web.UI.Page

Dim G_Index As Integer
'Public Shared G_Index As Integer

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
G_Index = 1
End Sub

Protected Sub btnPrevious_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
labelJobNo.Text = (Val(labelJobNo.Text) - 1).ToString
G_Index -= 1
MsgBox("G_Index: " + G_Index)
End Sub

Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
labelJobNo.Text = (Val(labelJobNo.Text) + 1).ToString
G_Index += 1
MsgBox("G_Index: " & G_Index.ToString)
End Sub
End Class

When I ran the page and viewed the value of 'G_Index' using MsgBox, the value only incremented once and the value stayed at 2 after a few clicking on the buttons. Why the value of global variable 'G_Index' NOT change?? Is my MS Web Developer 2008 setting has a problem?? Please pin point what is wrong with my code?

At the moment I am using labelJobNo.Text value to act as a global value to be accessed by several buttons and subs, but I would like to be able to use G_Index as a global value.
Any help really appreciated...

Thank you,