vb.net 编写一个函数注意:参数为动态数组;
Private Function MyF(ByRef d() As Integer)
ReDim d(4, 13) As Integer
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim MyNum(4) As Integer
For i = 1 To 4
MyNum(i) = 0
Next i
Randomize
For i = 1 To 4
For j = 1 To 13
n = Int(Rnd * 4 + 1)
Do While MyNum(n) = 13
n = Int(Rnd * 4 + 1)
Loop
d(i, j) = n
MyNum(n) = MyNum(n) + 1
Next j
Next i
End Function
VB.net 如何编写一个可以返回数组的函数(过程)?public function createstringarr() as string()
return new string(){"d1","d2","d3","d4"}
end function
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
【vb.net中数组的函数 vb使用数组】End Sub
运行效果:
vb.net 返回一个数组的函数public function createstringarr() as string()
return new string(){"d1","d2","d3","d4"}
end function
vb.net中数组的函数的介绍就聊到这里吧 , 感谢你花时间阅读本站内容 , 更多关于vb使用数组、vb.net中数组的函数的信息别忘了在本站进行查找喔 。
推荐阅读
- 你算什么mv舞蹈视频,你算什么下一句
- thinkphp5教程,thinkphp6 教程
- 养成类游戏恋爱免费,推荐养成游戏恋爱
- 程序员学python可以吗,程序员学几种语言比较好
- mysql集群怎么部署的 mysql集群解决方案
- Python提取某一个变量,python怎么提取数据中的部分数据
- translate在css中什么意思,css中的transition
- 电脑直播伴侣如何直播,电脑直播伴侣怎么开直播
- ctlvb.net的简单介绍