Microsoft KB Archive/827047

= BUG: The SelectionMode poperty of the data-bound ListBox control or of the CheckedListBox control does not prompt you to provide a valid value =

Article ID: 827047

Article Last Modified on 4/16/2007

-

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

-





SYMPTOMS
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:

Invalid property value

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.



STATUS
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

 * 1) Start Microsoft Visual Studio .NET.
 * 2) Create a new Windows application by using Microsoft Visual Basic .NET or by using Microsoft Visual C# .NET.

By default, Form1 is created.
 * 1) Add a ListBox control to Form1.

By default, ListBox1 is created.
 * 1) On the View menu, click Server Explorer.
 * 2) In Server Explorer, right-click the Data Connections node, and then click Add Connection.
 * 3) 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.
 * 1) In the Select the database on the server box, click Northwind database.
 * 2) In the Data Link Properties dialog box, click OK.
 * 3) In Server Explorer, expand the Data Connections node.
 * 4) Expand your local SQL Server data connection.
 * 5) Expand the Tables node, and then drag the Employees table to Form1.
 * 6) Right-click SqlDataAdapter1, and then click Generate Dataset.
 * 7) In the Generate Dataset dialog box, click OK.
 * 8) Right-click ListBox1, and then click Properties.
 * 9) In the Properties dialog box, set the DataSource property to DataSet11.Employees.
 * 10) Set the DisplayMember property to EmployeeID.
 * 11) Set the SelectionMode property to NONE.

You receive an error message.
 * 1) 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.

