ARRAY问题 [英] ARRAY issues

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

问题描述

嗯,我的阵列似乎无缘无故地排空了自己。我只想抓住发布到页面的每个表单元素到一个

大小合适的数组......这里发生了什么?


dim arrShort()

元素= 0

dim frm
每个frm在Request.Form中的


元素=元素+ 1

next


Redim Preserve arrShort(Elements)

xx = 0

请求中的每个frm .Form

arrShort(xx)= frm& : &安培; request.form(frm)& "< br>"

Response.Write(" **"& arrShort(xx))''工作正常

next


''***这个部分下面只有一个元素占有率???

为q = 0到UBound(arrShort)

回复.Write(" VERIFY:"& arrShort(q))''由于某种原因不起作用

next


提前致谢!

解决方案



" MMMMM" <无***** @ replytogroup.com>在消息中写道

新闻:Og ************** @ TK2MSFTNGP15.phx.gbl ...

嗯,我的阵列似乎无缘无故地排空自己。我只是想把贴在页面上的每个表单元素都抓到一个大小合适的数组......这里发生了什么?

dim arrShort()
Request.Form中每个元素的元素= 0
dim frm
元素=元素+ 1
下一个

Redim Preserve arrShort(Elements)
xx = 0
对于Request.Form中的每个frm
arrShort(xx)= frm& : &安培; request.form(frm)& "< br>"
Response.Write(" **"& arrShort(xx))''工作正常
下一步

''** *下面的这一部分只有一个元素大众化???
对于q = 0到UBound(arrShort)
Response.Write(VERIFY:"& arrShort(q))''不因某种原因工作


提前致谢!



你忘了在for循环中增加xx。


" Chris Hohmann" <无**** @ thankyou.com>在消息中写道

news:u9 ************** @ TK2MSFTNGP14.phx.gbl ...


; MMMMM" <无***** @ replytogroup.com>在消息中写道
新闻:Og ************** @ TK2MSFTNGP15.phx.gbl ...

嗯,我的阵列似乎在清空自己没原因。我只是想把贴在页面上的每个表单元素都抓到一个大小合适的数组......这里发生了什么?

dim arrShort()
Request.Form中每个元素的元素= 0
dim frm
元素=元素+ 1
下一个

Redim Preserve arrShort(Elements)
xx = 0
对于Request.Form中的每个frm
arrShort(xx)= frm& : &安培; request.form(frm)& "< br>"
Response.Write(" **"& arrShort(xx))''工作正常
下一步

''** *下面的这一部分只有一个元素大众化???
对于q = 0到UBound(arrShort)
Response.Write(VERIFY:"& arrShort(q))''不因某种原因工作


提前致谢!


你忘了在for循环中增加xx。



另请注意,在声明/重新声明数组时,我认为声明语句中的参数

表示数组的上限,而不是其大小的b / b
。因此,您的数组是一个太大的元素。我知道,直觉上并不是很明显,但这就是零基数组世界中的生命。 :)


>> arrShort(xx)= frm& : &安培; request.form(frm)& " br>"

xx将始终为0.您需要增加xx - xx = xx + 1

Response.Write(" VERIFY:"& arrShort(q))''由于某种原因不起作用


什么是不起作用是什么意思?


Bob Lehmann


" MMMMM" <无***** @ replytogroup.com>在消息中写道

新闻:Og ************** @ TK2MSFTNGP15.phx.gbl ...嗯,我的阵列似乎无缘无故地排空了自己。我只想
抓住发布到页面的每个表单元素到一个适当大小的数组......这里发生了什么?

dim arrShort()
Elements = 0 < Request.Form中每个frm的dim frm

Elements = Elements + 1
下一个

Redim Preserve arrShort(Elements)
xx = 0请求Request.Form中的每个frm
arrShort(xx)= frm& : &安培; request.form(frm)& "< br>"
Response.Write(" **"& arrShort(xx))''工作正常
下一步

''** *下面的这一部分只有一个元素大众化???
对于q = 0到UBound(arrShort)
Response.Write(VERIFY:"& arrShort(q))''不因某种原因工作


提前致谢!



Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an
appropriately sized array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) '' Works fine
next

'' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reason
next

Thanks in advance!

解决方案


"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...

Hmmm, my array seems to be emptying itself for no reason. I just want to
grab every form element posted to the page into an appropriately sized
array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) '' Works fine
next

'' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reason
next

Thanks in advance!


You forgot to increment xx in the for loop.


"Chris Hohmann" <no****@thankyou.com> wrote in message
news:u9**************@TK2MSFTNGP14.phx.gbl...


"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...

Hmmm, my array seems to be emptying itself for no reason. I just want to
grab every form element posted to the page into an appropriately sized
array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) '' Works fine
next

'' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reason
next

Thanks in advance!


You forgot to increment xx in the for loop.


Also note that when declaring/redeclaring an array, I believe the parameter
in the declaration statement represents the upper bound for the array, not
its size. As such, your array is one element too large. I know, it''s not
intuitively obvious, but such is life in a world of zero-based arrays. :)


>> arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
xx will always be 0. You need to increment xx - xx = xx+1

Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reason

What does "Does not work" mean?

Bob Lehmann

"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl... Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an appropriately sized array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) '' Works fine
next

'' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reason
next

Thanks in advance!



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

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