[Mono-bugs] [Bug 546009] New: ComboBox: Set Text property throws exception if using DropDown style and bound to data
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Oct 11 01:30:16 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=546009
Summary: ComboBox: Set Text property throws exception if using
DropDown style and bound to data
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: x86
OS/Version: All
Status: NEW
Severity: Critical
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: helmut at just-code.com
QAContact: mono-bugs at lists.ximian.com
Found By: Community User
Description of Problem:
If using a ComboBox in DropDown mode (allowing bound data items + any text),
and there is data bound to the combo box, when now trying to change the
currdent text in the combo box via the Text property, the ComboBox throws an
'Object does not match target type' exception.
Steps to reproduce the problem:
1. Put a ComboBox on any form
2. Set ComboBox.DropDownStyle to ComboBoxStyle.DropDown
3. Use a list of custom objects as the ComboBox.DataSource
4. use ComboBox.Text to set the displayed text to any string value (that is not
contained in the data source!)
Actual Results:
'Object does not match target type' exception
Expected Results:
ComboBox should display the text
How often does this happen?
Always
Additional Information:
FIX:
change line 813 of file System.Windows.Forms\ComboBox.cs
from:
textbox_ctrl.Text = GetItemText (value);
to:
textbox_ctrl.Text = value;
GetItemText assumes that the passed value is of the same type as all items in
the bound list, but in this case, the value is of course always of type
System.String
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list