内部暗淡选择案例执行无论如何? [英] Dim inside Select case executes in any case?

查看:67
本文介绍了内部暗淡选择案例执行无论如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样的代码

=======================

选择案例q

案例" a"

Dim arr(5)

案例" b"

Dim arr(2)

结束选择

=====================

返回错误说变量arr重新定义。

应该是这样还是我使用Select错误?也许某些东西

类似于需要使用break?

Code like this
=======================
Select case q
Case "a"
Dim arr(5)
Case "b"
Dim arr(2)
end select
=====================
returns an error saying variable arr redefined.
Should it be like that or an I using Select incorrectly? Perhaps something
similar to break needs to be used?

推荐答案

aa写道:
aa wrote:

这样的代码

=======================

选择案例q

案例a

Dim arr(5)

案例" b"

Dim arr(2)

结束选择

=====================

返回一个错误,说变量arr已重新定义。

应该是这样还是我使用Select错误?也许

需要使用类似于break的东西?
Code like this
=======================
Select case q
Case "a"
Dim arr(5)
Case "b"
Dim arr(2)
end select
=====================
returns an error saying variable arr redefined.
Should it be like that or an I using Select incorrectly? Perhaps
something similar to break needs to be used?



您只能声明一次静态数组。你需要使用动态数组:


dim arr()

选择案例q

案例a

ReDim arr(5)

案例" b"

ReDim arr(2)

结束选择


您可以在此处获取vbscript文档:
http:/ /tinyurl.com/7rk6


-

Microsoft MVP - ASP / ASP.NET

请回复到新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

没有垃圾邮件

You can only declare a static array once. You need to use a dynamic array:

dim arr()
Select case q
Case "a"
ReDim arr(5)
Case "b"
ReDim arr(2)
end select

You can get the vbscript documentation here:
http://tinyurl.com/7rk6

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


谢谢,

它看起来它应该是ReDim在第一次decalration


" Bob Barrows [MVP]" < re ****** @ NOyahoo.SPAMcomwrote in message

news:O6 ************** @ TK2MSFTNGP02.phx.gbl ...
Thanks,
It looks like it should be ReDim at the first decalration

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:O6**************@TK2MSFTNGP02.phx.gbl...

aa写道:
aa wrote:

这样的代码

===== ==================

选择案例q

案例a

昏暗的arr(5)

案例" b"

Dim arr(2)

结束选择

= ====================

返回一个错误,说变量arr已重新定义。

应该是这样还是我使用选择不正确吗?也许

需要使用类似于break的东西?
Code like this
=======================
Select case q
Case "a"
Dim arr(5)
Case "b"
Dim arr(2)
end select
=====================
returns an error saying variable arr redefined.
Should it be like that or an I using Select incorrectly? Perhaps
something similar to break needs to be used?



您只能声明一次静态数组。你需要使用动态数组:


dim arr()

选择案例q

案例a

ReDim arr(5)

案例" b"

ReDim arr(2)

结束选择


您可以在此处获取vbscript文档:
http:/ /tinyurl.com/7rk6


-

Microsoft MVP - ASP / ASP.NET

请回复到新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件


You can only declare a static array once. You need to use a dynamic array:

dim arr()
Select case q
Case "a"
ReDim arr(5)
Case "b"
ReDim arr(2)
end select

You can get the vbscript documentation here:
http://tinyurl.com/7rk6

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"



aa写道:
aa wrote:

谢谢,

看起来它应该是ReDim的第一个decalration
Thanks,
It looks like it should be ReDim at the first decalration



是什么让你这么说的?它不应该。首先使用Dim声明它,然后使用ReDim重新定义它。这真的在

文档中得到了很好的介绍......

What makes you say that? It shouldn''t. Start by declaring it with with Dim,
then use ReDim to redefine it. This really is well-covered in the
documentation ...


>

" Bob Barrows [MVP] QUOT; < re ****** @ NOyahoo.SPAMcomwrote in message

news:O6 ************** @ TK2MSFTNGP02.phx.gbl ...
>
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:O6**************@TK2MSFTNGP02.phx.gbl...

> aa写道:
>aa wrote:

>>这样的代码
=== ====================
选择案例q
案例a
Dim arr(5)
案例" b"
Dim arr(2)
结束选择
=====================
返回错误说变量arr重新定义。
它应该是那样还是我使用Select错误?也许
类似于需要使用的休息?
>>Code like this
=======================
Select case q
Case "a"
Dim arr(5)
Case "b"
Dim arr(2)
end select
=====================
returns an error saying variable arr redefined.
Should it be like that or an I using Select incorrectly? Perhaps
something similar to break needs to be used?


您只能声明一次静态数组。你需要使用一个动态的数组:

dim arr()
选择案例q
案例a
ReDim arr(5)<案例" b"
ReDim arr(2)
结束选择

你可以在这里获得vbscript文档:
http://tinyurl.com/7rk6



-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


这篇关于内部暗淡选择案例执行无论如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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