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



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

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.

MORE INFORMATION

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.
  3. Add a ListBox control to Form1.

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

    You receive an error message.
  18. 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.

REFERENCES

For more information, visit the following Microsoft Web site:

Modification Type:MinorLast Reviewed:2/9/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbDataBinding kbProperties kbWindowsForms kbListBox kbForms kbCtrl kbControl kbbug KB827047 kbAudDeveloper