vb.net数组的定义问题
在vb中创建数组:dimarr(4)asstringarr(0)="a"arr(1)="b"arr(2)="c"arr(3)="d"在vb中没有问题,在vb.net中报错...
在vb中创建数组:
dim arr(4) as string
arr(0)="a"
arr(1)="b"
arr(2)="c"
arr(3)="d"
在vb中没有问题,在vb.net中报错。那么在vb.net中应该怎样定义呢 展开
dim arr(4) as string
arr(0)="a"
arr(1)="b"
arr(2)="c"
arr(3)="d"
在vb中没有问题,在vb.net中报错。那么在vb.net中应该怎样定义呢 展开
2个回答
展开全部
刚刚在VS2012上将你的代码试了一下:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim arr(4) As String
arr(0) = "a"
arr(1) = "b"
arr(2) = "c"
arr(3) = "d"
Dim i As Integer
For i = 0 To 3
Debug.WriteLine(arr(i))
Next
End Sub
显示:
a
b
c
d
正常运行,没有报错。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim arr(4) As String
arr(0) = "a"
arr(1) = "b"
arr(2) = "c"
arr(3) = "d"
Dim i As Integer
For i = 0 To 3
Debug.WriteLine(arr(i))
Next
End Sub
显示:
a
b
c
d
正常运行,没有报错。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询