
正文
vb.net函数数组 vb使用数组
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net 返回一个数组的函数
public function createstringarr() as string()
return new string(){"d1","d2","d3","d4"}
end function
相关问答
Q1: vb.net中返回一个数组的函数的问题
给你一个简单的示例:
Option Explicit
Private Function GetRndInt() As Integer()
' 返回一个 Integer类型的数组
Dim i As Long, aTemp() As Integer
Randomize
ReDim aTemp(15)
For i = 0 To 15
aTemp(i) = Rnd() * 500
Next
GetRndInt = aTemp
End Function
Private Sub Command1_Click()
Dim aTemp() As Integer
Dim i As Long
Me.Cls
aTemp = GetRndInt
Print "随机产生的数据为:"
For i = 0 To UBound(aTemp)
Print i + 1, aTemp(i)
Next
End Sub
运行效果:
Q2: VB.net 如何编写一个可以返回数组的函数(过程)?
public function createstringarr() as string()
return new string(){"d1","d2","d3","d4"}
end function
vb.net函数数组的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb使用数组、vb.net函数数组的信息别忘了在本站进行查找喔。






