When you create an array you need to know three things

  • The name of the array
  • What the likely size (maximum) will be
  • What type of data it will store

If you know that you will need to mix data types or that you do not think there will be a maximum size then arrays can not be used. Arrays are always a fixed size and a single data type

A common mistake is to try and define a array as

Dim names(5) As Array

Or even just

Dim names As Array

This is not correct. Array is a specific data structure within visual basic and technically it is a class not an array. If you try and use it you will have some very strange problems when you run your code. The first example would actually create a array of the data type Array. As you get on in programming you will understand why that is the case. For now just ensure you use the definition as shown in the diagram.