You receive an "ArgumentOutOfRangeException" exception if you add items to the CheckedListBox control in the BeginUpdate method and the EndUpdate method with the Sorted property set to true (820630)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
SYMPTOMSIf you add items with the check parameter or the isChecked parameter to
the CheckedListBox control in the BeginUpdate method and the EndUpdate method to maintain
performance, and you set the Sorted
property to True before you add the items, then you may receive the following exception: An
unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in
system.windows.forms.dll.
Additional information: Specified argument
was out of the range of valid values. RESOLUTIONTo work around this bug, set the Sorted property to True
after you add all the items to the CheckedListBox control, as in the following examples. Microsoft Visual Basic .NET Code CheckedListBox1.BeginUpdate()
CheckedListBox1.Items.Clear()
CheckedListBox1.Items.Add("Item1", True)
CheckedListBox1.EndUpdate()
CheckedListBox1.Sorted = True Microsoft Visual C# .NET Code checkedListBox1.BeginUpdate();
checkedListBox1.Items.Clear();
checkedListBox1.Items.Add("Item1", true);
checkedListBox1.EndUpdate();
checkedListBox1.Sorted=true; STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
REFERENCES
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
327896
BUG: CheckedListBox Control Loses Check Marks When the Visible
Property Is Changed to FALSE and Then Back to TRUE
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbCtrl kbControl kbListBox kbbug KB820630 kbAudDeveloper |
---|
|