That is correct. If you do not declare and dimension the array before using it, that's the error you'll get.
Put this in at the beginning of the program.
Dim btn%(500)
This allocates 2012 bytes of storage for 501 long integers (4 bytes for each integer, long pointer to memory and other overhead)
Put this in at the beginning of the program.
Dim btn%(500)
This allocates 2012 bytes of storage for 501 long integers (4 bytes for each integer, long pointer to memory and other overhead)