Sorted TStringList error - Operation not allowed on sorted list
delphi, delphi-2010
Solution
Writing your own routine to get the index value obviously won't help since that's not where the problem lies. You're not allowed to directly modify an element of a sorted list because doing so might invalidate the sort order.
Delete the item from the list and insert the new item.
Customers.Delete(idx);
Customers.Add(Edit1.Text + '=' + Edit2.Text + ',' + Edit3.Text);
Or, set `Sorted := False`.
Problem
I am getting the following error - "Operation not allowed on sorted list" ``` Idx:= Customers.IndexOfName(ListView1.Selected.Caption); Customers[idx]:= Edit1.Text + '=' + Edit2.Text + ',' + Edit3.Text //error occurs here ``` Is there any way around this? other than writng my own routine to get the index value thanx