I am having some luck in the project I'm working on, but have been frustrated with this little glitch. If you are familiar with Sheridan's ActiveListBar, hopefully you can help.

I am trying to build a list through code. I have the list being built with no trouble. I'm trying to associate the appropriate icons now. I seem to have the icons loaded into the IconsLarge and IconsSmall collections. I am trying to associate the ListItem to the specific icon in the collection. I am getting an error:

40002 - Invalid Index value was passed in.

Here is the code I am trying to use:

Code:
For i = 1 To iItemCount
   Rem Read details from specific section
   Let sSectionHeader = colItems.Item(i)
   Let iMenu = CInt(mfncGetFromIni(ByVal sSectionHeader, ByVal "Menu", ByVal gsINIPath))
   Let sIconPath = mfncGetFromIni(ByVal sSectionHeader, ByVal "IconPath", ByVal gsINIPath)
                
   Rem Add to toolbar
   Rem Select appropriate group
   SSListBar1.CurrentGroup = iMenu
        
   Rem Add to current group
   SSListBar1.ListItems.Add i, , colItems.Item(i)
         
   MsgBox SSListBar1.ListItems.Count ' 1
        
   Rem Add to icon collections
   SSListBar1.IconsLarge.Add i, , sIconPath
   SSListBar1.IconsSmall.Add i, , sIconPath
         
   MsgBox SSListBar1.IconsLarge.Item(i).Index  ' 1
   MsgBox SSListBar1.IconsSmall.Item(i).Index  ' 1
       
   Rem Set property in listitem to specify appropriate icon
   SSListBar1.ListItems(i).IconLarge = i  ' Error
   SSListBar1.ListItems(i).IconSmall = i

Next
The error seems to be with the SSListBar1.ListItems(i) portion. I have a feeling I'm missing something relatively basic, but I'm stumped.

Any ideas?

Thanks!!!

Dan