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?
Printable View
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?
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
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
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.Code:Dim myUser as User
I am using VB 6 Professional
use classes