Ich habe dies:WinForms Combox - Artikel zu einem Databound-Liste hinzufügen und dann die Einstellung der SelectedItem sein
cmbConnections.DisplayMember = "Name";
cmbConnections.ValueMember = "Index";
cmbConnections.DataSource = DBConnectionSettings.ConnectionList;
All Ok!
Jetzt neues Element zur Liste hinzufügen:
DBConnectionSettings.Connection c = new DBConnectionSettings.Connection();
c.Name = reply;
c.Index = DBConnectionSettings.ConnectionList.Count + 1;
DBConnectionSettings.ConnectionList.Add(c);
ich nun dieses neue Element in der comboxbox als das ausgewählte Element angezeigt werden soll. Das Setzen des Textes der Combobox schlägt fehl.
Dank
Warum tun Sie Count + 1, dachte ich, Graf 1 Basis zumindest so wäre, wenn alles, was es Count -1 sein würde. –