System.IndexOutOfRangeException in vb.net when using arrays

后端 未结 2 661
小蘑菇
小蘑菇 2021-01-23 21:32

Well, I have tried to complete a challenge that requires me to get all of the multiples of 5 or 3 from 0 to 1000 and then get the sum of them, I am new to vb.net so I thought th

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-23 21:51

    You need to allocate memory to Numbers array and since the size is known initially you may allocate while declaring:

    Dim Numbers(1000) As Integer

提交回复
热议问题