I'm not sure HOW you are changing the data in List1, but try this in a new project with a Command1 button that changes one of the items.
Code:Option Explicit Private Type ProductUDT Name As String Description As String End Type Dim Products() As ProductUDT, i As Long Dim FileLoc As String Private Sub cmdDelete_Click() List1.RemoveItem List1.ListIndex 'After the ListIndex removal, then what about the UDT?? Form_Load 'Update list End Sub Private Sub cmdAddNew_Click() 'What to do with the UDT changes? '??? Form_Load 'Update list End Sub Private Sub Command1_Click() List1.List(1) = "changed" End Sub Private Sub Form_Load() Dim Itm As String Dim Desc As String Dim counter As Integer Dim bDoneOnce As Boolean Dim strData() As String Dim strParts() As String Dim lngIndex As Long List1.Clear bDoneOnce = GetSetting(App.EXEName, "Application Data", "Run Once", False) If Not bDoneOnce Then FileLoc = App.Path & "\thefile.txt" Open FileLoc For Input As #1 Do Until EOF(1) counter = counter + 1 Input #1, Itm, Desc ReDim Preserve Products(1 To counter) Products(counter).Name = Itm Products(counter).Description = Desc Loop Close Else strData = Split(GetSetting(App.EXEName, "Application Data", "Values"), "|") ReDim Products(UBound(strData)) For lngIndex = 0 To UBound(strData) strParts = Split(strData(lngIndex), ",") Products(lngIndex).Name = strParts(0) Products(lngIndex).Description = strParts(1) Next End If For i = LBound(Products) To UBound(Products) List1.AddItem Products(i).Name List1.ItemData(List1.NewIndex) = i Next Me.Caption = "Total Item : " & List1.ListCount SaveSetting App.EXEName, "Application Data", "Run Once", True End Sub Private Sub Form_Unload(Cancel As Integer) Dim lngIndex As Long Dim strDataString As String For lngIndex = 0 To UBound(Products) - 1 strDataString = strDataString & List1.List(lngIndex) & "," _ & Products(lngIndex + 1).Description & "|" Next strDataString = Left$(strDataString, Len(strDataString) - 1) SaveSetting App.EXEName, "Application Data", "Values", strDataString End Sub Private Sub List1_Click() i = List1.ItemData(List1.ListIndex) lblDescription.Caption = "Description: " & vbNewLine & _ Products(i).Description End Sub




Reply With Quote