When you set the
SelectionMode property of the data-bound
ListBox control or of the data-bound
CheckedListBox control to
NONE in the Microsoft Windows Form Designer, you receive the following
error message:
If you
click
OK in the message box, you set the
SelectionMode property to
NONE. However, you might not expect the
SelectionMode property to be set to
NONE. The Form Designer does not prompt you to provide a valid
value.
Note When you run the Windows application after you set the
SelectionMode property to
NONE, you receive the following error message:
An
unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll
Additional information: Cannot call this
method when SelectionMode is SelectionMode.NONE.
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
Steps to Reproduce the Behavior
- Start Microsoft Visual Studio .NET.
- Create a new Windows application by using Microsoft Visual
Basic .NET or by using Microsoft Visual C# .NET.
By default, Form1 is
created. - Add a ListBox control to Form1.
By default, ListBox1 is created. - On the View menu, click Server
Explorer.
- In Server Explorer, right-click the Data
Connections node, and then click Add
Connection.
- In the Data Link Properties dialog box,
select or type the name of your local computer that is running Microsoft SQL
Server in the Select or enter a server name box.
Note If any, type the name of your local computer that is running
Microsoft SQL Server in the User name box. If any, type your
password in the Password box. - In the Select the database on the server
box, click Northwind database.
- In the Data Link Properties dialog box,
click OK.
- In Server Explorer, expand the Data
Connections node.
- Expand your local SQL Server data connection.
- Expand the Tables node, and then drag the
Employees table to Form1.
- Right-click SqlDataAdapter1, and then
click Generate Dataset.
- In the Generate Dataset dialog box, click
OK.
- Right-click ListBox1, and then click
Properties.
- In the Properties dialog box, set the
DataSource property to
DataSet11.Employees.
- Set the DisplayMember property to
EmployeeID.
- Set the SelectionMode property to
NONE.
You receive an error message. - Click OK in the Properties
Window message box.
The SelectionMode
property is set to NONE.
Note This bug only occurs for the
CheckedListBox control in Microsoft Visual Studio .NET 2002.
For more information, visit the following Microsoft Web
site:
Article ID: 827047 - Last Review: April 16, 2007 - Revision: 1.5
APPLIES TO
- Microsoft Visual Basic .NET 2003 Standard Edition
- Microsoft Visual Basic .NET 2002 Standard Edition
- Microsoft Visual C# .NET 2003 Standard Edition
- Microsoft Visual C# .NET 2002 Standard Edition
| kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbdatabinding kbproperties kbwindowsforms kblistbox kbforms kbctrl kbcontrol kbbug KB827047 |