我试着定义了这么个类型
private type customtype
  a1 as integer 
  a2 as integer 
  a3 as integer 
end type
private type TypeT
   typss() as customtype
   num as integer
end typedim df() as typetredim df (0) as typet
redim df(0).typss(0) as customtype
到这里都不报错
可是要用df(0).typss(0).a1=1
时就报错,具体这样的一个数据怎么传递叻?

解决方案 »

  1.   

    Private Type customtype
      a1 As Integer
      a2 As Integer
      a3 As Integer
    End Type
    Private Type TypeT
       typss() As customtype
       num As Integer
    End Type
    Private Sub Command1_Click()
    Dim df() As TypeT
    ReDim df(0)
    ReDim df(0).typss(0)
    df(0).typss(0).a1 = 1
    df(0).typss(0).a2 = 2
    df(0).typss(0).a3 = 3MsgBox df(0).typss(0).a2
    End Sub
      

  2.   

    這個語句出錯﹕ redim df(0).typss(0) as customtype
    只用到這個語句就夠了 ﹕redim df (0) as typet
      

  3.   

    private type customtype
      a1 as integer 
      a2 as integer 
      a3 as integer 
    end type
    private type TypeT
       typss() as customtype
       num as integer
    end type因為TypeT是有兩個屬性typss﹑num,而typss又有它的子屬性a1,a2,a3
    所以你重新定義的時候只需要重新定義TypeT就夠了這就相當于C里面講到的類的繼承問題
      

  4.   

    '没错呀.
    Private Type customtype
      a1 As Integer
      a2 As Integer
      a3 As Integer
    End Type
    Private Type TypeT
       typss() As customtype
       num As Integer
    End TypePrivate Sub Command1_Click()
    Dim df() As TypeTReDim df(0) As TypeT
    ReDim df(0).typss(0) As customtype df(0).typss(0).a1 = 1
    MsgBox df(0).typss(0).a1End Sub
      

  5.   

    給它賦值時象 northwolves(狼行天下) 寫的那種就可以了