title: Visual Basic 6 Runtime Error 381 "Invalid Property Array Index"
body: <p>I am a noob to programming especially in Visual Basic. I am only using VB6 because I have to use it for college and I am totally stuck.</p>
  
  <p>I have a listbox in which I want to display a name of a radio and then when I click the name I want it to put data into some textboxes, it is simple I know but I don't even fully know the VB6 syntax so I am totally stuck I have asked my teacher but he is not really any help.</p>
  
  <p>This is the line that is highlited when I click debug:</p>
  
  <pre><code>x = radCatList.ItemData(radCatList.ListIndex)
  </code></pre>
  
  <p>This is code for the enitre form, again it is very simple and I barely know what I am doing most of this project is a copy and paste job:</p>
  
  <pre><code>Option Explicit
  
  Private Sub Form_Load()
  Dim r As radioRec
  Dim radioChan As Integer
  Dim x As Integer
  
  x = 1
  radioChan = FreeFile
  Open radioFile For Random As radioChan Len = radioLen
  Get radioChan, x, r
  Do While Not EOF(radioChan)
      radCatList.AddItem r.rModel
      radCatList.ItemData(radCatList.NewIndex) = x
      x = x + 1
      Get radioChan, x, r
  Loop
  Close radioChan
  End Sub
  
  Private Sub radCatList_Click()
  Dim r As radioRec
  Dim radioChan As Integer
  Dim x As Integer
  
  radCatList.Clear
  
  x = radCatList.ItemData(radCatList.ListIndex)
  radioChan = FreeFile
  Open radioFile For Random As radioChan Len = radioLen
  Get radioChan, x, r
  channelTxt = r.rLicense
  licenseTxt = r.rLicense
  rangeTxt = r.rRange
  stockTxt.Text = r.rStock
  Close radioChan
  End Sub
  </code></pre>