全局变量不是全球变量? [英] Global Variables nott Global?

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

问题描述

我有一个模块声明几个数组为public,一些字符串,一些

整数。然后我有2个表格。表格A是主要表格,加载

启动,并有一个命令按钮打开表格B.在表格B上有几个文本框,其中数组值可以更改,但是当我关闭B并返回A时,这些值会丢失。我以为Public意味着

公开?


Larry L

I have a Module that declares several arrays as public, some string, some
integers. I then have 2 forms. Form A is the main form, that loads on
start-up, and has a command button to open Form B. On form B there are
several text boxes where the array values can be changed, however when I
close B and go back to A, those values are lost. I thought Public meant
Public?

Larry L

推荐答案

> ;我有一个模块声明几个数组为public,一些字符串,一些
> I have a Module that declares several arrays as public, some string, some
整数。然后我有2个表格。表单A是主要表单,它在
启动时加载,并有一个命令按钮来打开表单B.在表单B上有几个文本框,其中数组值可以更改,但是当我关闭B然后回到A,那些价值就丢失了。我以为Public意味着公开?
integers. I then have 2 forms. Form A is the main form, that loads on
start-up, and has a command button to open Form B. On form B there are
several text boxes where the array values can be changed, however when I
close B and go back to A, those values are lost. I thought Public meant
Public?




您是否有机会在FormA或FormB上声明一个数组,其中

相同你在模块中公开的那个名字?


Rick - MVP



Did you by any chance declare an array on either FormA or FormB with the
same name as the one you made Public in your Module?

Rick - MVP


文章< hu **** ****************@comcast.com> ;,Rick Rothstein < RI ************ @ NOSPAMcomcast.net>写道:
In article <hu********************@comcast.com>, "Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote:
我有一个模块声明几个数组为public,some string,some
整数。然后我有2个表格。表单A是主要表单,它在
启动时加载,并有一个命令按钮来打开表单B.在表单B上有几个文本框,其中数组值可以更改,但是当我关闭B然后回到A,那些价值就丢失了。我认为Public意味着公开吗?
I have a Module that declares several arrays as public, some string, some
integers. I then have 2 forms. Form A is the main form, that loads on
start-up, and has a command button to open Form B. On form B there are
several text boxes where the array values can be changed, however when I
close B and go back to A, those values are lost. I thought Public meant
Public?



你有没有机会在FormA或FormB上声明一个数组,其名称与你公开的名字相同你的模块?

Rick - MVP



Did you by any chance declare an array on either FormA or FormB with the
same name as the one you made Public in your Module?

Rick - MVP




Rick,


不,完全没有。 A表单从

表单加载中的文件中读取3个数组的值,然后显示自身。它实际上是6个项目,每个包含3个

信息(1个字符串,1个整数和1个布尔值)。这些项目不是表格A上的
。然后我点击表格B看到18个文本框(6x3)和

这些变量名称,显示值。我现在看到

文件中的值没有显示在那里。


仅供参考,我在单个表单上完成了所有这些工作,但它'混乱,并且

我想将变量输入移动到另一种形式(启动时只需要

)。

Larry L



Rick,

No, not at all. The A form reads values for the 3 arrays from a file in
Form Load and then shows itself. It''s actually 6 items, with 3 pieces of
information each (1 string, 1 integer, and 1 Boolean). Those items are not
represented on form A. I then click form B to see 18 text boxes (6x3) with
those variable names, showing the values. I now see that the values in the
file are NOT shown there.

FYI, I had all this working fine on a single form, but it''s cluttered, and
I wanted to move the variables input to another form (It will only be
needed at start-up).

Larry L


你在哪里将表格B上输入的新值分配回

数组?全球*是*全球......你在某处出现了错误。


-


Randy Birch

MVP Visual Basic
http://www.mvps.org/vbnet /

请只回复新闻组,以便所有人都能受益。

" Larry L" < LA *** @ somewhereinhawaii.net>在消息中写道

新闻:yH ******************* @ twister.socal.rr.com ...

:在文章< hu ******************** @ comcast.com> ;,Rick Rothstein

< ri ************@NOSPAMcomcast.net>写道:

:>>我有一个模块,声明几个数组为公共,一些字符串,

一些

:>>整数。然后我有2个表格。表格A是主要表格,加载

:>>启动,并有一个命令按钮打开表B.在表B上有

:>>几个文本框,其中数组值可以更改,但是当



:>>关闭B并返回A,这些值丢失了。我认为Public意味着

:>>公开?

:>

:>你有没有机会在FormA或FormB上使用

声明一个数组:>与您在模块中公开的名称相同?

:>

:> Rick - MVP



:Rick,



:不,完全没有。 A表单从

:Form Load中的文件中读取3个数组的值,然后显示自身。它实际上是6个项目,包含3个

:每个信息(1个字符串,1个整数和1个布尔值)。这些项目不是

:在表单A上表示。然后单击表单B以查看18个文本框(6x3)和

:这些变量名称,显示值。我现在看到

:文件中的值没有显示在那里。



:仅供参考,我把这一切都搞好了一个单一的表格,但它很杂乱,并且

:我想将变量输入移动到另一个表格(它只会是

:启动时需要)。



:Larry L
Where are you assigning the new values entered on Form B back into the
array? Global *is* global ... you''ve got an error somewhere.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"Larry L" <la***@somewhereinhawaii.net> wrote in message
news:yH*******************@twister.socal.rr.com...
: In article <hu********************@comcast.com>, "Rick Rothstein"
<ri************@NOSPAMcomcast.net> wrote:
: >> I have a Module that declares several arrays as public, some string,
some
: >> integers. I then have 2 forms. Form A is the main form, that loads on
: >> start-up, and has a command button to open Form B. On form B there are
: >> several text boxes where the array values can be changed, however when
I
: >> close B and go back to A, those values are lost. I thought Public meant
: >> Public?
: >
: >Did you by any chance declare an array on either FormA or FormB with the
: >same name as the one you made Public in your Module?
: >
: >Rick - MVP
:
: Rick,
:
: No, not at all. The A form reads values for the 3 arrays from a file in
: Form Load and then shows itself. It''s actually 6 items, with 3 pieces of
: information each (1 string, 1 integer, and 1 Boolean). Those items are not
: represented on form A. I then click form B to see 18 text boxes (6x3) with
: those variable names, showing the values. I now see that the values in the
: file are NOT shown there.
:
: FYI, I had all this working fine on a single form, but it''s cluttered, and
: I wanted to move the variables input to another form (It will only be
: needed at start-up).
:
: Larry L


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

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