How do I hold a global variable in VB.NET? I am creating as ASP web form
like this:
Public Class WebForm1 Inherits System.Web.UI.P age
Dim list as new ListItemCollect ion()
-
-
-
Private Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles Button1.Click
list.Add(TextBo x1.text())
End Sub
End Class
The problem I am having is everytime I click Button1, the program jumps to
the global declaration of 'Dim list as new ListItemCollect ion()' and I lose
what was already in 'list'.
I moved the declaration to Global.asax.vb file, but the declaration is not
seen by my WebForm1.aspx file.
Any help?
Thanks,
Joseph
like this:
Public Class WebForm1 Inherits System.Web.UI.P age
Dim list as new ListItemCollect ion()
-
-
-
Private Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles Button1.Click
list.Add(TextBo x1.text())
End Sub
End Class
The problem I am having is everytime I click Button1, the program jumps to
the global declaration of 'Dim list as new ListItemCollect ion()' and I lose
what was already in 'list'.
I moved the declaration to Global.asax.vb file, but the declaration is not
seen by my WebForm1.aspx file.
Any help?
Thanks,
Joseph