不可以! 这样会提示你缺少 End Type 结束符 其实VB的自由性很大的 尽量把自己的代码写的规范一些 是有好处的
你是不是指这个意思?Private Type UserType Test1 As String Test2 As Integer test3 As Double End TypePrivate Sub Command2_Click() Dim uTest As UserType
uTest.Test1 = "Tezst" uTest.Test2 = 1 uTest.test3 = 3 End Sub
不可以。用一下迂回的方法:Type A H As Integer G As Long End TypeType B J As A P As Single End Type
Type student name As String age As Integer End Type
Type student1 ll As student End Type 调用时就可以这样了: Private Sub Command1_Click() Dim stu1 As student1 stu1.ll.name = "lily" Print stu1.ll.name stu1.ll.age = 12 Print stu1.ll.age End Sub这样就可以成功的调用了.
这样会提示你缺少
End Type 结束符
其实VB的自由性很大的
尽量把自己的代码写的规范一些
是有好处的
Test1 As String
Test2 As Integer
test3 As Double
End TypePrivate Sub Command2_Click()
Dim uTest As UserType
uTest.Test1 = "Tezst"
uTest.Test2 = 1
uTest.test3 = 3
End Sub
H As Integer
G As Long
End TypeType B
J As A
P As Single
End Type
name As String
age As Integer
End Type
Type student1
ll As student
End Type
调用时就可以这样了:
Private Sub Command1_Click()
Dim stu1 As student1
stu1.ll.name = "lily"
Print stu1.ll.name
stu1.ll.age = 12
Print stu1.ll.age
End Sub这样就可以成功的调用了.