private type type_1
     t_1 as String
     t_2 as ong
end type

解决方案 »

  1.   

    Private Type SystemInfo
       CPU As Variant
       Memory As Long
       VideoColors As Integer
       Cost As Currency
       PurchaseDate As Variant
    End TypeDim MySystem AS SystemInfo
    MySystem.CPU = "486"
    If MySystem.PurchaseDate > #1/1/92# Then ....
      

  2.   

    '要试用本例请在窗体中加一个按钮,然后在代码窗体中粘贴如下代码'定义结构
    Private Type Student
            Name As String
            Sex As String
            Age As Long
    End TypePrivate Sub Command1_Click()
        '声明变量为结构类型
        Dim typS As Student
            
        '给结构元素赋值
        typS.Name = "王二小"
        typS.Sex = "男"
        typS.Age = 18    '引用结构元素的值
        MsgBox typS.Name
        MsgBox typS.Sex
        MsgBox typS.Age
    End Sub