1
Answer

Populating a ComboBox from a collection

TC Power

TC Power

16y
6.5k
1

I would to populate a country combo box using a collection. The code for the collection is below:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace BUI

{

public class CountryCollection : BUIBaseCollection<Country>

{

public static CountryCollection FetchList()

{

CountryCollection obj = new CountryCollection();

obj.MapObjects(new DAL.Country().FetchList());

return obj;

}

}

}

Fetchlist is a stored procedure that returns all records in a table. My problem is to populate my combo box I am using this code:

this.cmbCountry.ItemsSource = BUI.CountryCollection.FetchList();

and instead of displaying the items in the table, it is displaying:

BUI.Country

BUI.Country

BUI.Country

Thanks

TC

Answers (1)