VB中数组定义类型

来源:百度知道 编辑:UC知道 时间:2024/09/22 20:32:19
Private Sub Form_Click()
Dim p() as Integer
Dim a as Integer
Dim b as Integer
Dim c as Integer
Dim d as Integer
Dim e as Integer
Dim f as Integer
p = Array(a, b, c, d, e, f)

End sub

运行到 p = Array(a, b, c, d, e, f)时出错,类型不匹配,请问如何定义P这个数据类型

Dim p()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
p = Array(a, b, c, d, e, f)

Dim p() as string

p = Array(a, b, c, d, e, f),用这个语句时,要求p必须是变体变量,所以前面定义就应该改为dim p

你这种定义方法很不严谨