Link to home
Start Free TrialLog in
Avatar of onebite2
onebite2

asked on

c#

I have to fill  and loadcombo box....below is my attached code sample...I was able to look that each name is added in the code but it is not being displayed in the UI.....did I miss anything???
public class ComboBoxItem
        {
            private string _Content = " ";
            public string Content
             {
            get
              {
            return this._Content;
              }
          set
              {
          this._Content = value;
               }
            }
          }
 
        private void LoadProjects()
        {
            ProjectCollection projects = taskTransfer.GetLocalProjects();
 
            // Add each project one at a time to the drop down list box so that a default one can
            // be added at the top.
           
          ComboBoxItem item;
           foreach (Project project in projects)
            {
                item = new ComboBoxItem();
                item.Content = project.Name;
                comboBox3.Items.Add(item);
                              
            }
       
          
            //// Insert the default row at the top and select it.
           //item = new ComboBoxItem();
           //item.Content = "select a project"
           //comboBox3.Items.Insert(0, item);
           //comboBox3.SelectedIndex = 0;
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of elimesika
elimesika
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of onebite2
onebite2

ASKER

Thanks!!This worked....