Global variables

J

Jonathan Perkins

How do i create global variables that keep their values
after the form is postback, (i.e. when a button is
clicked, etc.) Thank you very much.
 
T

Tu-Thach

Can you be more specific? If you are talking about global
variables, then the Application object can store variables
that are accessible within the whole application.

Tu-Thach
 
J

Jonathan Perkins

For instance, i would like to have four or five variables
than can be read and written to from my subs and
functions. The problem that i am having is that
everytime a button (asp:button) is clicked these
varaibles loose there values. When i try to only DIM the
variables, when Page.IsPostBack = False, the functions
can't initially see the variables and I recieve
compliation errors. Thank you
 
J

Jay B. Harlow [MVP - Outlook]

Jonathan,
ASP.NET has a number of facilities to store variables between round trips
with a client:

The following may be helpful for you to review to find your options:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconWebFormState.asp

Specifically:
http://msdn.microsoft.com/library/d...vbcon/html/vbconChoosingServerStateOption.asp

The following article provides a good overview of the 9 options available:
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top