[Mono-winforms-list] ValueMember and DisplayMember issue

Rolf Bjarne Kvinge rolflists at ya.com
Wed Jul 11 05:21:41 EDT 2007



> -----Original Message-----
> From: mono-winforms-list-bounces at lists.ximian.com [mailto:mono-
> winforms-list-bounces at lists.ximian.com] On Behalf Of Dario Quintana
> Sent: lunes, 02 de julio de 2007 16:59
> To: mono-winforms-list at lists.ximian.com
> Subject: [Mono-winforms-list] ValueMember and DisplayMember issue
> 
> Hi people,
> 
> I can't do work fine in a combobox the properties ValueMember and
> DisplayMember.
> In the comboBox text Mono show me the result of ToString() and is not
> considering the sets of Display/ValueMember properties.
> 
> This code show the issue:
> 
> 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");
>     	}
>     }
> }
> 

This looks like a bug, please file a report here: http://bugzilla.ximian.com

Rolf

> --
> Dario Quintana
> http://blog.darioquintana.com.ar
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.476 / Virus Database: 269.10.0/887 - Release Date:
> 05/07/2007 13:55




More information about the Mono-winforms-list mailing list