本文介绍了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 提前致谢! 解决方案 你忘了在for循环中增加xx。 你忘了在for循环中增加xx。 另请注意,在声明/重新声明数组时,我认为声明语句中的参数 表示数组的上限,而不是其大小的b / b 。因此,您的数组是一个太大的元素。我知道,直觉上并不是很明显,但这就是零基数组世界中的生命。 :) 什么是不起作用是什么意思? Bob Lehmann " MMMMM" <无***** @ replytogroup.com>在消息中写道 新闻:Og ************** @ TK2MSFTNGP15.phx.gbl ...嗯,我的阵列似乎无缘无故地排空了自己。我只想抓住发布到页面的每个表单元素到一个适当大小的数组......这里发生了什么? dim arrShort() Elements = 0 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 anappropriately sized array... What is going on here? dim arrShort()Elements = 0dim frmfor each frm in Request.FormElements = Elements + 1next Redim Preserve arrShort(Elements)xx = 0for each frm in Request.FormarrShort(xx) = frm & ": " & request.form(frm) & "<br>"Response.Write("** " & arrShort(xx)) '' Works finenext '' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???for q = 0 to UBound(arrShort)Response.Write("VERIFY: " & arrShort(q)) '' Does not work for some reasonnext Thanks in advance! 解决方案 You forgot to increment xx in the for loop. You forgot to increment xx in the for loop.Also note that when declaring/redeclaring an array, I believe the parameterin the declaration statement represents the upper bound for the array, notits size. As such, your array is one element too large. I know, it''s notintuitively obvious, but such is life in a world of zero-based arrays. :)What does "Does not work" mean? Bob Lehmann "MMMMM" <no*****@replytogroup.com> wrote in messagenews:Og**************@TK2MSFTNGP15.phx.gbl... Hmmm, my array seems to be emptying itself for no reason. I just want tograb 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问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 08:57