本文介绍了是否有可能以负值vb开始一个数组.网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的视觉基本代码
Here is my visual basic code
Sub info()
If False=0 Then
ReDim W(-2 to N+2)
End If
this Coding working in vb 6.0
But the same coding transferred to vb.net it shows an error Array lower bound to be 0
谁能指导我如何解决此问题?
Can any one please guide me how to fix this issue
推荐答案
Dim N1 As Integer = 100
Dim W1(0) As Integer
ReDim W1(0 To N1 + 4)
For counter As Integer = 0 To 104
W1(counter) = counter
Next
Dim N2 As Integer = 100
Dim W2(0) As Integer
ReDim W2(0 To N2 + 4)
For counter As Integer = -2 To 102
W2(counter + 2) = counter
Next
Dim W3 As System.Collections.Generic.Dictionary(Of Integer, Integer)
W3 = New Dictionary(Of Integer, Integer)
For counter As Integer = -2 To 102
W3.Add(counter, counter)
Next
这篇关于是否有可能以负值vb开始一个数组.网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!