数组整数与数组变量 [英] Array Integers vs Array Variables

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

问题描述

在使用数组时,我发现我无法使用具有整数值的变量来维度和数组

但是我可以将其重新定义为

方式。我没有看到任何信息告诉我这是否是一个要求,

虽然看起来是因为如果我尝试的话我会收到错误。


Ex。


昏暗b

b = 10

点亮a(b)''这个错误但是

Dim a()''这个

Redim a(b)''作品

-

Roland Hall

/ *这些信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp

解决方案

" Roland Hall"写道......

Dim b
b = 10
昏暗a(b)''这个错误但是
Dim a()''这个
Redim a(b)''作品




我几个月前在工作中遇到了完全相同的问题,只是使用了
$最后b $ b redim似乎没问题 - 只是假设是设计好的......


Rob


" ; Rob Meade写道:

:Roland Hall写道......



:>昏暗b

:> b = 10

:>昏暗a(b)''这个错误但是

:>昏暗a()''这个

:> Redim a(b)''作品



:几个月前我在工作中遇到了完全相同的问题,只是使用了

:redim到最后似乎没问题 - 只是假设它是设计的......


谢谢Rob。我得出了相同的结论,所以我一直在寻找一些

推理,而不是它的工作方式。我不是很滑稽。我ñ
非常感谢您的反馈。我只是不明白为什么如果

redimensioning它的作用,当尺寸标注没有,并且没有看到任何

文献来解释它。很高兴知道我不会完全疯狂直到

某人发布了我想念的东西,我想。 (O:=


-

Roland Hall

/ *此信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。* /

Technet脚本中心 - http://www.microsoft.com/technet/scriptcenter/

WSH 5.6文档 - http:// msdn .microsoft.com / downloads / list / webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp


Roland Hall于2004年8月8日写道在

microsoft.public.inetserver.asp.general:

Dim b
b = 10
Dim a(b)' ' 这个错误但是
昏暗a()''这个
Redim a(b)''作品



b = 101

Redim a (b)

response.write ubound(a)


看,妈妈,没有暗淡!


- -

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)


In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven''t see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.

Ex.

Dim b
b = 10
Dim a(b) '' this errors out but
Dim a() '' this
Redim a(b) '' works
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

解决方案

"Roland Hall" wrote...

Dim b
b = 10
Dim a(b) '' this errors out but
Dim a() '' this
Redim a(b) '' works



I had exactly the same problem at work a few months back, just used the
redim in the end and it seemed ok - just assumed it was by design...

Rob


"Rob Meade" wrote:
: "Roland Hall" wrote...
:
: > Dim b
: > b = 10
: > Dim a(b) '' this errors out but
: > Dim a() '' this
: > Redim a(b) '' works
:
: I had exactly the same problem at work a few months back, just used the
: redim in the end and it seemed ok - just assumed it was by design...

Thanks Rob. I came to the same conclusion so I was looking for some
reasoning other than that''s how it works. I''m not being facetious. I
really appreciate the feedback. I just didn''t understand why if
redimensioning it works when dimensioning doesn''t and have not see any
literature to explain it. It''s nice to know I''m not completely crazy until
someone posts with something I''m missing, I guess. (O:=

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


Roland Hall wrote on 08 feb 2004 in
microsoft.public.inetserver.asp.general:

Dim b
b = 10
Dim a(b) '' this errors out but
Dim a() '' this
Redim a(b) '' works


b = 101
Redim a(b)
response.write ubound(a)

Look, mama, no dims!

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


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

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