I have a ListBox with DataSource set to my strongly typed collection.
The ListBox is on a page of TabControl.
I use ListBox.Sorted = true (set in designer) to keep items in my list sorted.
The list box is filled. Now, If I swith to other tab page and back, I get exception "Additional information: Cannot modify the Items collection when the DataSource property is set."
If I set ListBox.Sorted = false, it works. But I want to keep it set to true.
Any hints? Or better solution how to keep ListBox sorted?
Thanks.
-Boudino

1 answers
If you can modify your Query String then add Order By "Field Name" Asc/Desc that will give you sorted output
answered 2 years ago by:
0
It may be surprising, I use no database so I have no query :) And If I would have it, how would I solve sorting if I just add or remove item in collection?
answered 2 years ago by:
0
And one more strange thing: on one my ListBox, if I have ListBox.Sorted = true, items are drawn using ToString() instead DisplayMember specification :(
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!