Daniel Golan

Daniel Golan

  • NA
  • 45
  • 47.6k

Splitting values in a combobox

Jan 30 2011 3:35 AM
Hello,

How can i split items in a combobox ?

using the code to populate the combo and wondering how i could modify the code to split the added item at "T" since i only need the first part of the attribute :
 private void populateCombo_dato()
        {
            cmb_dato.Items.Clear();
            //åpner xml
            XDocument xmlDoc = XDocument.Load(lab_url.Text);
            //leser attributt fra bestemt setd
            var xmlAtt = from att in xmlDoc.Elements("weatherdata").Elements("forecast").Elements("tabular").Elements("time").Attributes("from")
                         select att;
            //loop og legg de i listen om de ikke finnes
            foreach (var record in xmlAtt)
            {

                if (!cmb_dato.Items.Contains(record.Value)) ;
                cmb_dato.Items.Add(record.Value);
                }
        }


Answers (6)