I have a form on which I have an array of 28 ListView boxes. These are used to display alphabetical lists controlled by a tab strip.

However when I run the code below which is used to read the data in from a datafile I am presented with the error: Runtime error'13': Type mismatch.

If any one has an idea what I am doing wrong it will be greatfully received.

VB Code:
  1. Dim AtoZlstNum As ListItem
  2. Dim AtoZlstLetter(27) As ListItem
  3.  
  4. For a = 1 To NumSongs
  5.   Line Input #1, SongTitle(a)
  6.   If InStr(1, SongTitle(a), ";", vbTextCompare) Then
  7.     SplitText = Split(SongTitle(a), ";", 2, vbTextCompare)
  8.     SongTitle(a) = SplitText(0)
  9.     Set AtoZlstLetter(27) = lstAtoZ(27).ListItems.Add(, , Str(a))
  10.     AtoZlstLetter(27).SubItems(1) = SplitText(1)
  11.   End If
  12.   b = Asc(Left(SongTitle(a), 1))
  13.   If b > 46 And b < 58 Then
  14.     Set AtoZlstNum = lstAtoZ(0).ListItems.Add(, , Str(a))
  15.     AtoZlstNum.SubItems(1) = SongTitle(a)
  16.   Else
  17.     b = b - 64
  18.     Set AtoZlstLetter(b) = lstAtoZ(b).ListItems.Add(, , Str(a))     <- Error occurs here
  19.     AtoZlstLetter(b).SubItems(1) = SongTitle(a)
  20.   End If
  21.   ProgressBar1.Value = a
  22. Next a


In advance Thank you