user defined types (vb6)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isotope11
    New Member
    • Mar 2007
    • 10

    user defined types (vb6)

    I have this code in the general declarations section of the form:

    Code:
    Option Explicit
    
    Type Example
    Value1 as Integer
    Value2 as Integer
    End Type
    and got this in the Form_Load:

    Code:
    Dim Unit as Example
    Unit.Value1 = 1
    Unit.Value2 = 2
    Label1 = CStr(Unit.Value2)
    then some sort of error comes out. What I have done wrong?
  • shidec
    New Member
    • May 2007
    • 26

    #2
    you only need private key in front of the declaration of type.
    It will become public if u not explicity write it,
    then public user defined type only allow in module

    [CODE=VB]
    Option Explicit
    Private Type Example
    Value1 As Integer
    Value2 As Integer
    End Type
    [/CODE]

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Could you be more specific than "some sort of error"?

      Comment

      Working...