Hi Guys, this is the code i have:
photoTypes() is just a string array declared as follows:VB Code:
Dim i As Integer = 0 While sqlRdr.Read() Dim arrChar As Char() = sqlRdr.Item("photoType").ToString.ToCharArray() If Not Char.IsDigit(arrChar(1)) Then For j As Integer = 0 To photoTypes.Length - 1 If Not photoTypes(j).ToString = sqlRdr.Item("photoType").ToString Then If j = photoTypes.Length - 1 Then photoTypes(i) = sqlRdr.Item("photoType").ToString ReDim Preserve photoTypes(i + 1) i += 1 End If End If Next End If End While
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:
Dim photoTypes(0) as string
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.VB Code:
If Not photoTypes(j).ToString = sqlRdr.Item("photoType").ToString Then
Thanks in advance for any help
![]()




Reply With Quote