I can think of a few ways:
- override the
ToString()
of aCity
class toreturn Name + "https://stackoverflow.com/" + Id;
- ditto, but with a
TypeConverter
- add a
DisplayText
property that return the same, and useDisplayMember
- build a shim class for the data
For the last:
var data = cities.Select(city => new {
Id = city.Id, Text = city.Name + "https://stackoverflow.com/" + city.Id }).ToList();
cbo.ValueMember = "Id";
cbo.DisplayMember = "Text";
cbo.DataSource = data;