2 Replies - 988 Views - Last Post: 08 October 2012 - 11:33 PM Rate Topic: -----

#1 jskidd3  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 57
  • Joined: 16-September 12

How to Filter Items in a Combo Box? (after XML is parsed)

Posted 08 October 2012 - 11:23 AM

Hi!

        Dim document As XmlReader = New XmlTextReader("http://myxmlfilehehe.com")
        Dim thekeys As String
        While (document.Read)
            Dim type = document.NodeType
            If (type = XmlNodeType.Element) Then
                If (document.Name = "Key") Then

                    thekeys = document.ReadInnerXml.ToString

                    ComboBox1.Items.Add(thekeys)
                End If
            End If
        End While


After this piece of code is executed I need a way to filter out certain items within the combo box. I thought this would be relatively easy but it turns out I'm having problems. My first idea was to just do If ComboBox1.Items.Contains etc then remove the line, but I can't seem to find something that will let me do this. I need to filter out a few words so they don't show up in the list.

Any ideas?

Regards,
Joel

Is This A Good Question/Topic? 0
  • +

Replies To: How to Filter Items in a Combo Box? (after XML is parsed)

#2 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: How to Filter Items in a Combo Box? (after XML is parsed)

Posted 08 October 2012 - 06:04 PM

You could filter them out before adding...
       If Not thekeys.Contains("Don't want this one.") Then
          ComboBox1.Items.Add(thekeys)
       End If


This post has been edited by lar3ry: 08 October 2012 - 06:05 PM

Was This Post Helpful? 1
  • +
  • -

#3 jskidd3  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 57
  • Joined: 16-September 12

Re: How to Filter Items in a Combo Box? (after XML is parsed)

Posted 08 October 2012 - 11:33 PM

So simple yet I couldn't see it. Thank you so much lar3ry!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1