Data structures allows to store complex data groups as a single type.
For example it is required to store and modify the group of data entries (e.g. Part Number, Cost, Supplier, etc.). In this case it would be beneficial to declare custom structure to represent the item as a single element instead of using multiple variables or arrays. User defined Type can be declared in the code and required fields can be added inside this type. This structure can be assigned to variable, passed to function or copied as any other value type.
In order to represent options which needs to be consumed by class or function, enumeration can be defined. Enumeration is a group of named constants of type Long which can be automatically incremented. And those constants can be accessed by their name instead of value, so this eliminates the issue of ‘magic numbers’.
This section contains the Visual Basic code examples which demonstrate the usage of different data structures.