An "An unhandled exception of type 'System.ArgumentException' occurred" error occurs when you set the Sorted property to True (316568)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft ADO.Net 2.0
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic 2005
This article was previously published under Q316568
This article refers to the following Microsoft .NET Framework Class Library namespaces:
- System.Data
- System.Data.SqlClient
SYMPTOMS
When you set the Sorted property of a ListBox control to True after you bind it to a datasource, you may receive the following exception:
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll.
Additional information: Can't modify the Items collection when the DataSource property is set.
RESOLUTION
To resolve this issue, set the Sorted property before you bind the ListBox to a datasource.
STATUSThis behavior is by design.REFERENCES
For more information about the ListBox.Sorted property and other properties pertaining to the ListBox class, browse to the following MSDN Web sites:
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbtshoot kberrmsg kbControl kbDataBinding kbListBox kbprb KB316568 kbAudDeveloper |
---|
|