I need to create an array of colours. I have this code but it gives me an error:
An unhandled exception of type 'System.NullReferenceException' occurred in AceMosaic.exe

Additional information: Object reference not set to an instance of an object.
VB Code:
  1. Dim colours() As Color
  2.         Dim c As Control
  3.         Dim intCount As Integer = -1
  4.         For Each c In gpbColours.Controls
  5.             If TypeOf c Is Label Then
  6.                 If c.Name.Substring(0, c.Name.IndexOf("_")).ToLower = "lblcolour" And c.Text = "X" Then
  7.                     intCount += 1
  8.                     colours(intCount) = c.BackColor
  9.                 End If
  10.             End If
  11.         Next

Can anyone tell me what I am doing wrong.