BindingSource.Sort

Arg81

Well-known member
Joined
Mar 11, 2005
Messages
949
Location
Midlands, UK
Programming Experience
1-3
I've added a column to the Sort field on one of my BindingSources.

However, when I close the form I get the error
Sort string contains a property that is not in the IBindingList.

huh? I searched on Google but couldn't find much - well specifically no answers to the problem.

My layout:

Form with combobox and grid (parent - child). If I edit the name that is displayed in the combobox, I want the names to appear in ASC order, so if I name something from ZONKY to AGAGAGA then when dropping the list down it's automatically sorted and that row changed position.


Anyone know the answer to the problem, or a better way of doing this?
 
I've had this.. Remove the sort before you close the form; when the underlying list is destroyed, an event fires that it has changed, and the sort routine attempts to sort on a column that no longer exists
 
yep, that's the one I found which I was setting the sort to nothing. However, I still get the error. Just about to try your suggestion.

ah I just seen to set .sort = Nothing in the Form_Closing event...I was setting it in my close button click command before I call me.close.

I'll have a go at that as well! :D
 
I have a similar problem

When I apply a sort field to a bindingsource, it works the first time. The next time it is applied, I get this error, and keep getting it every time I try to change the sort, even if I try bindingsource.sort = nothing, or bindingsource.sort = "" first.

I apply the sort by using bindingsource.sort = srt.

Any thoughts on this?
 

Latest posts

Back
Top