Hi all . i have an application that loads a playlist text file in to listboxes. The playlist text file has the song name and song path . When i try to load the playlist file i get the follwoing error

Run-time error 9

subscript out of range
pointing at the following line:

'Check for unwanted vbCrLf (which would yeild a "")
If Len(strArr(intLB)) <> 0 Then

could you guys help me fix this error? Looking forward for replies.Thanks


2 Code:
  1. Private Sub Command1_Click()
  2.  
  3. Dim i As Long
  4. Dim intLB As Long   'Is an index counter
  5. Dim lngCtr As Long  'Represents the count of individual lines of data
  6. Dim strOpenPathFile As String, strArr() As String, strBuffArr() As String
  7.        
  8.     With CommonDialog1
  9.         .CancelError = True
  10.         On Error GoTo CommDiaCancelled
  11.         .Filter = "Text Files (*.txt)|*.txt|Word Doc (*.doc)|*.doc"
  12.         .ShowOpen
  13.     End With
  14.    
  15.     strOpenPathFile = CommonDialog1.FileName
  16.  
  17.     Open strOpenPathFile For Input As #1
  18.         strArr = Split(Input(LOF(1), 1), vbCrLf)
  19.     Close #1
  20.  
  21.     'Clear all the ListBoxs
  22.     List1.Clear
  23.     List2.Clear
  24.      lngCtr = UBound(strArr)
  25.  
  26.     For intLB = 0 To lngCtr
  27.    
  28. CommDiaCancelled:
  29.     If Err.Number = 32755 Then
  30.         MsgBox "Cancel selected !"
  31.         Exit Sub
  32.     End If
  33.         'Check for unwanted vbCrLf (which would yeild a "")
  34.         If Len(strArr(intLB)) <> 0 Then
  35.  
  36.             'Split the Line of data
  37.             strBuffArr = Split(strArr(intLB), vbTab)
  38.  
  39.             'Load the data into the ListBoxs
  40.  
  41.             List1.AddItem strBuffArr(0)
  42.             List2.AddItem strBuffArr(1)
  43.            
  44.         End If
  45.     Next
  46.     Call Number(List1, " - ")
  47. List1.Selected(0) = True
  48. For i = List1.ListCount - 1 To 0 Step -1 ' counts list entries
  49.     If List1.Selected(i) = True Then ' if selected then
  50.         Text1.Text = List1.List(i) ' add to other list
  51.         Text2.Text = List2.List(i)
  52.         Text3.Text = List1.List(i)
  53.         Text3.Text = Replace(Text3.Text, ".mp3", "")
  54.         Text3.Text = Replace(Text3.Text, ".avi", "")
  55.         Text3.Text = Replace(Text3.Text, ".asf", "")
  56.         Text3.Text = Replace(Text3.Text, ".mpeg", "")
  57.         Text3.Text = Replace(Text3.Text, ".mpg", "")
  58.         Text3.Text = Replace(Text3.Text, ".wav", "")
  59.         Text3.Text = Replace(Text3.Text, ".wmv", "")
  60.         Text3.Text = Replace(Text3.Text, ".wma", "")
  61.         Text3.Text = Replace(Text3.Text, ".cda", "")
  62.         Text3.Text = Replace(Text3.Text, ".mid", "")
  63.         Text3.Text = Replace(Text3.Text, ".midi", "")
  64.         Text3.Text = Replace(Text3.Text, ".rm", "")
  65.         RichTextBox3.TextRTF = Replace(RichTextBox1.TextRTF, "%song", Text3)
  66.         If Option2.Value = True Then
  67.         Else
  68.      
  69.         End If
  70.     End If
  71. Next
  72.  
  73. Text10.Text = List1.ListCount
  74. End Sub