冷媒管材质:在VB界面中怎样找到Type语句应该怎样使用?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 20:20:28

该示例使用 Type 语句,定义用户自定义的数据类型。Type 语句只能在模块级使用。如果要在类模块中使用,则必须在 Type 语句前冠以关键字 Private。

Type EmployeeRecord '创建用户自定义的类型。
ID As Integer '定义元素的数据类型。
Name As String * 20
Address As String * 30
Phone As Long
HireDate As Date
End Type

Sub CreateRecord()
Dim MyRecord As EmployeeRecord '声明变量。

'对 EmployeeRecord 变量的赋值必须在过程内进行。
MyRecord.ID = 12003 '给一个元素赋值。
End Sub