hi, for school we are to create a game in vb (master mind)

so anyway i want to make my code very condensed, now i have used a variety of different programming tools, but vb is new to me, i want to assign an array to my objects so i can make my code small

at the moment the object is a label, so i am not sure how to assign it

either
VB Code:
  1. Dim slotname(5) As Object
or
VB Code:
  1. Dim slotname(5) As Label

then in one of my scripts i run this code
VB Code:
  1. slotname(0) = lbl_slot1 'names of my labels in vb
  2. slotname(1) = lbl_slot2
  3. slotname(2) = lbl_slot3
  4. slotname(3) = lbl_slot4
  5. slotname(4) = lbl_slot5

in another script i run this code
VB Code:
  1. While colour_setup < 4
  2.         colourslot_rand(colour_setup) = Int(Rnd * 5)
  3.         colourslot(colour_setup) = colourslot_rand(colour_setup)
  4.         slotname(colour_setup).BackColor = colourslot(colour_setup)
  5.         colour_setup = colour_setup + 1
  6.     Wend

Now in this code basically this will pick a random colour and assign it to the labels background colour


whenever i run this script i get the error

Run-time error '91'

Object variable or With block variable not set

and it then proceeds to go to this line of code

VB Code:
  1. slotname(0) = lbl_slot1


can someone please help me to gain a better understanding of how vb works in this sence?