[Mono-bugs] [Bug 82069][Nor] New - ValueMember/DisplayMember at ComboBox with Dictionary don't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 11 10:53:08 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by contacto at darioquintana.com.ar.

http://bugzilla.ximian.com/show_bug.cgi?id=82069

--- shadow/82069	2007-07-11 10:53:08.000000000 -0400
+++ shadow/82069.tmp.20729	2007-07-11 10:53:08.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 82069
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: contacto at darioquintana.com.ar               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ValueMember/DisplayMember at ComboBox with Dictionary don't work
+
+Description of Problem:
+In a ComboBox the properties ValueMember and DisplayMember don't works fine.
+In the comboBox Text property show me the result of ToString() and is not
+considering the sets of DisplayMember/ValueMember properties.
+The above code fails in the Assert.
+
+
+Steps to reproduce the problem:
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using NUnit.Framework;
+
+namespace Mono.Sms
+{
+   internal static class Program
+   {
+       private static void Main()
+       {
+           Application.EnableVisualStyles();
+           Application.SetCompatibleTextRenderingDefault(false);
+           Application.Run(new form());
+       }
+   }
+
+   public class form : Form
+   {
+       private ComboBox combo = new ComboBox();
+
+       public form()
+       {
+               Dictionary<string, string> dict = new
+Dictionary<string,string>();
+
+               dict.Add("key1","value1");
+               dict.Add("key2","value2");
+
+               foreach (KeyValuePair<string, string> pair in dict)
+           {
+               combo.Items.Add(pair);
+           }
+
+               combo.ValueMember = "Value";
+               combo.DisplayMember = "Key";
+
+               this.Controls.Add(combo);
+
+               combo.SelectedIndex = 0;
+
+               Assert.AreEqual(combo.Text, "key1");
+       }
+   }
+}
+
+Actual Results:
+The Text property get with string value "[key1, value1]", the ToString() value.
+
+Expected Results:
+It's extected the value "key1" in the ComboBox Text property.
+
+How often does this happen? 
+Always.


More information about the mono-bugs mailing list