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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [EMAIL PROTECTED]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to