开发者

Filling in a VBScript array in a for loop

I'm attempting to create and fill in a two-dimensional array in VBScript, which resides in an ASP page. I have the following code:

Dim array(11, 6)

For record = 0 To 6
    array(6, record) = 8
    array(7, record) = "test"
Next

array(6, 3) = 8
array(7, 3) 开发者_如何学C= "test"

The for loop doesn't work, though. Nothing gets filled in. If I do it explicitly, like the code after the loop, that works just fine.

I've hardly ever used VBScript before but this seems like it should work. Why is my loop not doing anything?


Your "doesn't work" doesn't work. You'll have to describe exactly what you expect and what happens instead. Otherwise -

Dim a(11,6)
For i = 0 To 6
    a(6,i) = i
    a(7,i) = "test"
Next
WScript.Echo a(6,0),a(7,0)
WScript.Echo a(6,6),a(7,6)

0 test
6 test

Is there an evil "On Error Resume Next" active?

WRT the OERN:

You could insert an "On Error GoTo 0" immediately before the critical/new code and continue driving with your eyes shut with an "On Error Resume Next" immediately after it.

Or: copy the new code into a clean/empty .vbs to be used by cscript.exe

Or: post the relevant part of the code completely.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜