比如
 type aa
  b  as  string 
  c  as  integer 
  d  as  string 
 end type dim  udtdata  as aa 
  udtdata. b = 'sadfasdfasdf"
  udtdata. c = 50
  dutdata .d = "asfdasasdfasdfas"请问如何得到实际长度
用Len(udtdata) = 10 这并不是实际长度!
 
  

解决方案 »

  1.   

    Private Type tagA03
        A001 As String * 10
        A002 As Integer
        A003 As Date
        A004 As Double
    End TypePrivate Sub Command1_Click()
        Dim tpyA03 As tagA03
        MsgBox Len(tpyA03)
    End Sub
      

  2.   

    private type aa
        b  as  string   '如果这里不写,则默认为4
        c  as  integer 
        d  as  string   '如果这里不写,则默认为4
    end type
      

  3.   

    Private Type tagA03
        A001 As String * 10  '10个字节
        A002 As Integer      '2个字节
        A003 As Date         '8个字节
        A004 As Double       '8个字节
    End Type