vb如何将大量数据直接用代码写入数组
Publicbushu(20,5)AsIntegerbushu(0,5)=Array(9,58,91,82,35)bushu(1,5)=Array(85,12,6,28,...
Public bushu(20, 5) As Integer
bushu(0, 5) = Array(9, 58, 91, 82, 35)
bushu(1, 5) = Array(85, 12, 6, 28, 37)
bushu(2, 5) = Array(96, 57, 12, 6, 93)
bushu(3, 5) = Array(0, 43, 66, 43, 71)
bushu(4, 5) = Array(6, 55, 1, 39, 19)
bushu(5, 5) = Array(55, 56, 41, 1, 70)
bushu(6, 5) = Array(30, 61, 2, 31, 39)
bushu(7, 5) = Array(48, 6, 13, 32, 8)
bushu(8, 5) = Array(76, 56, 78, 14, 21)
bushu(9, 5) = Array(63, 95, 67, 72, 4)
bushu(10, 5) = Array(7, 20, 68, 28, 40)
bushu(11, 5) = Array(45, 84, 54, 17, 97)
bushu(12, 5) = Array(42, 40, 53, 40, 89)
bushu(13, 5) = Array(58, 83, 49, 73, 93)
bushu(14, 5) = Array(95, 20, 52, 8, 28)
bushu(15, 5) = Array(74, 65, 49, 87, 97)
bushu(16, 5) = Array(34, 79, 27, 47, 72)
bushu(17, 5) = Array(35, 30, 40, 60, 36)
bushu(18, 5) = Array(2, 85, 0, 32, 86)
bushu(19, 5) = Array(18, 60, 30, 5, 25)
这样可以吗,为什么提示无效的外部进程,有没有类似这样的写法,不想用读取文本文档的方法 展开
bushu(0, 5) = Array(9, 58, 91, 82, 35)
bushu(1, 5) = Array(85, 12, 6, 28, 37)
bushu(2, 5) = Array(96, 57, 12, 6, 93)
bushu(3, 5) = Array(0, 43, 66, 43, 71)
bushu(4, 5) = Array(6, 55, 1, 39, 19)
bushu(5, 5) = Array(55, 56, 41, 1, 70)
bushu(6, 5) = Array(30, 61, 2, 31, 39)
bushu(7, 5) = Array(48, 6, 13, 32, 8)
bushu(8, 5) = Array(76, 56, 78, 14, 21)
bushu(9, 5) = Array(63, 95, 67, 72, 4)
bushu(10, 5) = Array(7, 20, 68, 28, 40)
bushu(11, 5) = Array(45, 84, 54, 17, 97)
bushu(12, 5) = Array(42, 40, 53, 40, 89)
bushu(13, 5) = Array(58, 83, 49, 73, 93)
bushu(14, 5) = Array(95, 20, 52, 8, 28)
bushu(15, 5) = Array(74, 65, 49, 87, 97)
bushu(16, 5) = Array(34, 79, 27, 47, 72)
bushu(17, 5) = Array(35, 30, 40, 60, 36)
bushu(18, 5) = Array(2, 85, 0, 32, 86)
bushu(19, 5) = Array(18, 60, 30, 5, 25)
这样可以吗,为什么提示无效的外部进程,有没有类似这样的写法,不想用读取文本文档的方法 展开
1个回答
展开全部
赋值过程必须写入事件过程或自定义过程中,比如
如果是在窗体:
Dim bushu(20, 5) As Variant '数组只能声明为Variant型,否则赋值时会出错
Private Sub Form_Load()
bushu(0, 5) = Array(9, 58, 91, 82, 35)
bushu(1, 5) = Array(85, 12, 6, 28, 37)
bushu(2, 5) = Array(96, 57, 12, 6, 93)
......
bushu(19, 5) = Array(18, 60, 30, 5, 25)
End Sub
如果是在模块中:
Public bushu(20, 5) As Variant '数组只能声明为Variant型,否则赋值时会出错
Sub Main()
bushu(0, 5) = Array(9, 58, 91, 82, 35)
bushu(1, 5) = Array(85, 12, 6, 28, 37)
bushu(2, 5) = Array(96, 57, 12, 6, 93)
......
bushu(19, 5) = Array(18, 60, 30, 5, 25)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询