VB编程求大神指导
PrivateSubn1_Click()Dimx()AsIntegerDimaAsIntegerDimiAsIntegerReDimx(a)AsIntegera=Int(...
Private Sub n1_Click() Dim x() As Integer Dim a As Integer Dim i As Integer ReDim x(a) As Integer a = Int(Rnd * 26 + 5) Randomize For i = 1 To a x(i) = Int(Rnd * 90 + 10) Next i List1.AddItem x(i)End Sub
为什么显示是x(i)呢下标越界呢?大神把这个题给出代码多加分~求指导。。 展开
为什么显示是x(i)呢下标越界呢?大神把这个题给出代码多加分~求指导。。 展开
1个回答
展开全部
有些顺序弄错了,修改如下即可:
Dim x() As Integer
Dim a As Integer
Dim i As Integer
Randomize
a = Int(Rnd * 26 + 5)
ReDim x(a) As Integer
For i = 1 To a
x(i) = Int(Rnd * 90 + 10)
List1.AddItem x(i)
Next i
Dim x() As Integer
Dim a As Integer
Dim i As Integer
Randomize
a = Int(Rnd * 26 + 5)
ReDim x(a) As Integer
For i = 1 To a
x(i) = Int(Rnd * 90 + 10)
List1.AddItem x(i)
Next i
追问
哇。给力哇。亲能不能帮着把这道题做一下呀
追答
已解决,在附件中,望采纳!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询