0
MenuItem menus = new MenuItem();
GridView1.DataSource = menus.GetDataTable();
GridView1.DataBind();

menus.GetDataTable() returns a DataTable. In the above case, we are returning to GridView. I need to populate the data into a combo box. How can i do it?

NOTE: Assume GetDataTable only returns records of a single column.

I'm using Winforms

peace
  • 837
  • 2
  • 12
  • 18
  • 1
    possible duplicate of [C# - Fill a combo box with a DataTable](http://stackoverflow.com/questions/256832/c-fill-a-combo-box-with-a-datatable) – Oliver May 19 '10 at 10:26
  • I wanted to pick your answer as best but i couldn't – peace May 19 '10 at 19:54

2 Answers2

0

Check if this helps you.

Community
  • 1
  • 1
Ram
  • 11,404
  • 15
  • 62
  • 93
0

Solution is:

    Country countryName = new Country();
    comCountryCus.DataSource = countryName.GetDataFromTable();
    comCountryCus.DisplayMember = "CountryName";

http://msdn.microsoft.com/en-us/library/w67sdsex%28v=VS.80%29.aspx

K.I.S.S - Keep It Simple & Stupid.

peace
  • 837
  • 2
  • 12
  • 18