全局变量 [英] Global variables

查看:103
本文介绍了全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在表单回发后创建保持其值

的全局变量(例如,当点击按钮时单击
等等)非常感谢你。

解决方案

你能更具体一点吗?如果你在谈论全局

变量,那么Application对象可以存储可在整个应用程序中访问的变量




Tu-Thach

-----原始消息-----
我如何在表格后创建保持其价值的全局变量
回复,(点击按钮时等等)非常感谢。



例如,我想要从我的潜艇和

函数中读取和写入四到五个变量

。我遇到的问题是,每次点击一个按钮(asp:按钮)时,

这些

可变的松散值。当我尝试只有DIM的

变量时,当Page.IsPostBack = False时,函数

最初看不到变量而我收到了

恭维错误。谢谢

-----原帖-----
你能更具体一点吗?如果你在谈论
globalvariables,那么Application对象可以存储在整个应用程序中可访问的
变量。

Tu-Thach

-----原始消息-----
如何在表单回发后创建保持其值的全局变量(即单击按钮时,非常感谢。




Jonathan,

ASP.NET有许多设施可以在往返之间存储变量

与客户:


以下内容可能对您有所帮助你的选择:
http://msdn.microsoft.com/library/de...bFormState.asp


具体来说:
http://msdn.microsoft.com/library/de...tateOption.asp


以下文章提供了9个可用选项的概述:
http://msdn.microsoft.com/msdnmag/is...e/default.aspx


希望这会有所帮助

Jay


" Jonathan Perkins" < jo*@igetnet.com>在消息中写道

news:02 **************************** @ phx.gbl ... < blockquote class =post_quotes>例如,我希望有四个或五个变量可以从我的subs和
函数中读取和写入。我遇到的问题是每次点击一个按钮(asp:按钮)这些
可变的松散值。当我尝试仅使用DIM变量时,当Page.IsPostBack = False时,函数
最初不能看到变量而且我收到了赞美错误。谢谢

-----原帖-----
你能更具体一点吗?如果你在谈论


全局

变量,那么Application对象可以存储


变量

可以访问整个应用程序。

Tu-Thach

-----原始消息-----
如何创建全局变量在表单回发后保持其价值
(即点击按钮等等)非常感谢。




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.

解决方案

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

-----Original Message-----
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.
.



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

-----Original Message-----
Can you be more specific? If you are talking about globalvariables, then the Application object can store variablesthat are accessible within the whole application.

Tu-Thach

-----Original Message-----
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.
.


.



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/de...bFormState.asp

Specifically:
http://msdn.microsoft.com/library/de...tateOption.asp

The following article provides a good overview of the 9 options available:
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Hope this helps
Jay

"Jonathan Perkins" <jo*@igetnet.com> wrote in message
news:02****************************@phx.gbl...

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

-----Original Message-----
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

-----Original Message-----
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.
.


.



这篇关于全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆