how to use enumeration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandru8
    New Member
    • Sep 2007
    • 145

    how to use enumeration

    Hi to all.

    [CODE=vb]
    Public Type hogan_cumn_buff
    Idtype As String * 2
    Idno As String * 16
    Maincountry As String * 6
    Residence As String * 2
    Hometel As String * 8
    Hometelext As String * 4
    Pagerno As String * 8
    Pagerext As String * 4
    Officetel As String * 8
    Officetelext As String * 4
    Mobileno As String * 12
    Action As String * 1
    Remarks(1 To 40) As String
    End Type
    [/CODE]
    In this type I have to assign a value by default, but I know it's not possible. Is there any way to assign a value?

    Thanks
    Last edited by Killer42; Jan 4 '08, 06:30 AM.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Perhaps you should be looking at using a class rather than a user-defined data type.

    However, if you do want to do it this way, perhaps you could simply invoke a function to create any new occurence, and the function would fill in any appropriate defaults.

    Which is kind of a vastly simplified version of a class, of course. :-)

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      When you declare a Variable with the above type, all the String inside the type will be Initialized to Blank String..

      To Assign some value, use this code:

      [code=vb]
      Dim TempVar As hogan_cumn_buff
      TempVar.Idtype ="AA"
      TempVar.Idno ="XYZZ"
      TempVar.Maincou ntry ="INDIA"
      ' And SO On...
      [/code]


      Regards
      Veena

      Comment

      Working...