我是新手不知道我的下列代码错在哪里
Private Sub Command1_Click()Dim i As Integer
Dim j As Integer
Dim temp As person
Dim a(3) As person
For i = 1 To 2
For j = i + 1 To 3
If a(j).name < a(i).name Then 提示我这句错误 说对象变量或with 未被设置
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next j
Next i
For i = 1 To 3
Set a(i) = New person
a(i).name = "南砼公司" + CStr(i)
a(i).address = "湖滨北路" + CStr(i)
Grid1.Row = i
Grid1.Col = 0
Grid1.Text = CStr(i)
Grid1.Row = i
Grid1.Col = 1
Grid1.Text = a(i).name
Grid1.Row = i
Grid1.Col = 2
Grid1.Text = a(i).address
Next i
End Sub --------------------编程问答-------------------- Set a(i) = New person
person是类吧,New --------------------编程问答-------------------- 我也是新手!很少用数组! --------------------编程问答-------------------- If a(j).name < a(i).name 之前,必须为a(n)创建对象
for i=0 to 3
set a(i)=new person
next --------------------编程问答--------------------
Dim temp As person
Dim a(3) As person
person是啥东西。VB里面没有这东西。
补充:VB , 基础类