ListItem Icon Property Sets Incorrect Icon

Summary

Id: 4089.3
Type: Bug Bug
Current Status: Resolved

Detail

23 Apr 2003 Open FTFakes

Always when I try to change a icon of a listitem then the icon of the next item is changed instead.

lvListView.ListItems(a).IconIndex = newicon

behaves like:

lvListView.ListItems(a + 1).IconIndex = newicon

I took a look at the source of your control and changed:

Friend Property Get fItemIconIndex(ByVal lIndex As Long) As Long pGetStyle lIndex , LVIF_IMAGE fItemIconIndex = m_tLV.iImageEnd PropertyFriend Property Let fItemIconIndex(ByVal lIndex As Long, ByVal lIconIndex As Long) pGetStyle lIndex , LVIF_IMAGE m_tLV.iImage = lIconIndex pSetIStyle lIndex , LVIF_IMAGEEnd Property

to:

Friend Property Get fItemIconIndex(ByVal lIndex As Long) As Long pGetStyle lIndex - 1, LVIF_IMAGE fItemIconIndex = m_tLV.iImageEnd PropertyFriend Property Let fItemIconIndex(ByVal lIndex As Long, ByVal lIconIndex As Long) pGetStyle lIndex - 1, LVIF_IMAGE m_tLV.iImage = lIconIndex pSetIStyle lIndex - 1, LVIF_IMAGEEnd Property

Now it is working fine :-)

20 Jun 2003 Resolved Steve McMahon

Fixed as suggested.