Hi Guys, this is the code i have:
VB Code:
  1. Dim i As Integer = 0
  2.             While sqlRdr.Read()
  3.                 Dim arrChar As Char() = sqlRdr.Item("photoType").ToString.ToCharArray()
  4.                 If Not Char.IsDigit(arrChar(1)) Then
  5.                     For j As Integer = 0 To photoTypes.Length - 1
  6.                         If Not photoTypes(j).ToString = sqlRdr.Item("photoType").ToString Then
  7.                             If j = photoTypes.Length - 1 Then
  8.                                 photoTypes(i) = sqlRdr.Item("photoType").ToString
  9.                                 ReDim Preserve photoTypes(i + 1)
  10.                                 i += 1
  11.                             End If
  12.                         End If
  13.                     Next
  14.                 End If
  15.             End While
photoTypes() is just a string array declared as follows:
VB Code:
  1. Dim photoTypes(0) as string
Now what i am trying to do is to add to an array only if the value doesn't already exist. Now when i run my program i get a null exception error when i get to the line:
VB Code:
  1. If Not photoTypes(j).ToString = sqlRdr.Item("photoType").ToString Then
I know there is something really simple that i am missing that will fix my problem but i cant seem to figure out what it is so if anyone could help me i'd really appreciate it.
Thanks in advance for any help