编译错误:with对像必须为用户定义类型

来源:百度知道 编辑:UC知道 时间:2024/06/30 17:20:50
Dim n%

Private Type student
Name As String * 10
sex As String * 4
telephone As Integer
school As String
End Type
Private stud(99) As student

Private Sub Command1_Click()

If n > 100 Then
MsgBox "输入人数超过数组声明的个数"
Else
With stud()
.Name = Text1
.sex = Text2
.telephone = Text3
.school = Combo1.Text
End With
Text1 = "": Text2 = "": Text3 = "":
n = n + 1
End If
End Sub

急,在线等。对有加分
哥们,能帮QQ留下不,我还有点点问题

Private stud(99) As student
stud是数组~有100个元素
你直接用with 全部 是不可以的 只能是单一个with
With stud(1)
.Name = Text1
.sex = Text2
.telephone = Text3
.school = Combo1.Text
End With

或者你可以用for 来给所有元素赋值。