[Mono-bugs] [Bug 349364] New: ComboBox: ValueMemeber not changed

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 17 16:24:14 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=349364


           Summary: ComboBox: ValueMemeber not changed
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: kobruleht2 at hot.ee
         QAContact: mono-bugs at ximian.com
          Found By: ---


To reproduce:

1. Run code
2. Select John
3. Press button

Observed:

W

Expected:

J



using System.Windows.Forms;
using System.Collections.Generic;

class testForm : Form {

  Storage s = new Storage();

  testForm() {
    Customer c = new Customer();
    c.Id = "J";
    c.Name = "John";

    List<Customer> l = new List<Customer>();
    l.Add(c);
    c = new Customer();
    c.Id = "W";
    c.Name = "Walter";
    l.Add(c);

    ComboBox cm = new ComboBox();
    cm.DisplayMember = "Name";
    cm.ValueMember = "Id";
    cm.DataSource = l;

    s.CustId = "W";

    cm.DataBindings.Add("SelectedValue", s, "CustId");

    Controls.Add(cm);
    Button b = new Button();
    b.Top = 80;
    b.Click += new System.EventHandler(b_Click);
    Controls.Add(b);

  }

  void b_Click(object sender, System.EventArgs e) {
    if (s.CustId == null)
      MessageBox.Show("Empty combobox must store null value");
    else
      MessageBox.Show(s.CustId.ToString());

  }

  class Customer {
    public string Id { get; set; }
    public string Name { get; set; }

  }

  class Storage {
    public string CustId { get; set; }
  }

  static void Main() {
    Application.Run(new testForm());
  }
}


-- 
Configure bugmail: https://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