Valhalla Legends Forums Archive | Visual Basic Programming | Listview adding item after sorting

AuthorMessageTime
CrAz3D
[code]        lvINFO.ListItems.Add , , cboType.Text
        lvINFO.ListItems(lvINFO.ListItems.Count).ListSubItems.Add , , txtTime.Text
        lvINFO.ListItems(lvINFO.ListItems.Count).ListSubItems.Add , , txtAmount.Text
        lvINFO.ListItems(lvINFO.ListItems.Count).ListSubItems.Add , , Date[/code]

I have my regular listview code that would typically add the itme @ the bottom of the listview...HOWEVER, since my items have been sorted the item is added in the listview according to where cboType.text should end up.  I'm not sure how to add the rest of the information (txtTime, txtAmount, & Date) to the correct index.  It wouldn't work by using the find function or w/e because cboType.text is listed multiple times in the listview already. 

Any ideas on how I would find the correct index to add the txtTime, txtAmount & Date to my listview?
January 29, 2005, 8:02 PM
Adron
Doesn't Add return something for you to use if you need to reference the newly added item?
January 29, 2005, 11:04 PM
CrAz3D
Well, the way I remedied this is busing some pscode code I found
[code]Set lItem = lvINFO.ListItems.Add(, , cboType.Text)
        lItem.ListSubItems.Add , , txtTime.Text
        lItem.ListSubItems.Add , , FN.Amount(cboType.Text, txtTime.Text)
        lItem.ListSubItems.Add , , Date
        lItem.Selected = True[/code]
lItem is an iteger
January 29, 2005, 11:25 PM

Search