469,353 Members | 2,066 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

Global Variable Declaration

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.Page
Dim list as new ListItemCollection()
-
-
-
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
list.Add(TextBox1.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 ListItemCollection()' 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


Jul 17 '05 #1
0 9534

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Thomas Matthews | last post: by
6 posts views Thread by rick | last post: by
44 posts views Thread by fabio | last post: by
16 posts views Thread by Roman Ziak | last post: by
4 posts views Thread by kuhrty | last post: by
4 posts views Thread by the_init | last post: by
112 posts views Thread by istillshine | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.