Results 1 to 4 of 4

Thread: UserDefined Types

  1. #1
    Guest

    Question

    Can you set default values in the definition of your user defined types.


    If not, I have created a function that will set all values to desired default values, how can I use this when I user redim preserve on an array of my udt?

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496

    Talking .

    Try using enumerated constants or Enums. You just place the definition of the Enum in the declaration section of the form or module:

    Code:
    Enum Bonus
        NoBonus = 0
        Standard = 5
        Special = 10
    End Enum

  3. #3
    Guest

    Question

    Thanks, but I don't think that helps.

    For example I have a datatype user.

    A user has a first name, last name, birthday, number of cars (these are made up fields)... but when I declare a type user

    Code:
    Dim myUser as User
    I would like to have some default values in case these are not set (other than the regular default values which may be valid) for example I would like number of cars (an integer) to be set to a negative number. On the declaration above User.NumCars would default to zero but I want it to default to a negative number because 0 may be a valid value but never set and I want to check if it has been set yet.

    I am using VB 6 Professional

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width