1 Replies - 779 Views - Last Post: 06 October 2012 - 02:46 PM Rate Topic: -----

#1 Taledus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 05-October 12

Filter XML in DataGridView from button.text property

Posted 05 October 2012 - 06:08 AM

Hello everyone,

I have a FlowLayoutPanel "flpCategories".

I have searched through the Nodes on the ITEMS.xml file,
created buttons listing the ITEM_category as the button.text,
then populated them on the FlowLayoutPanel "flpCategories".

My flpCategories now displays 1 button for each ITEM_category in ITEMS.xml.

My DataGridView "dgvItems" automatically populates properly with the data from the XML on the form.load event.

I added a handler for when a button in the flow layout panel is clicked, it starts my sort sub:
    Private Sub categoryButtonclick(ByVal sender As Button, ByVal e As System.EventArgs)

        SortCategories(sender)

    End Sub



I have already verified that the "sender.text" is the button.text property being sent.

Now I try to sort by the ITEM_category with the selected button.text:
    Private Sub SortCategories(ByVal sender As Button)

        Dim xmlFile As XmlReader
        xmlFile = XmlReader.Create(Application.StartupPath & "\ITEMS.xml", New XmlReaderSettings())
        Dim ds As New DataSet
        Dim dv As DataView
        ds.ReadXml(xmlFile)
        dv = New DataView(ds.Tables(0), "ITEM_category" = sender.text, "ITEM_height", DataViewRowState.CurrentRows)
        dgvItems.DataSource = dv.ToTable

    End Sub



Problem: my dgvItems will only display the proper headers but wipes out all the data and does not display any data from the xml file. I have no clue why this is not working, or what else I could possibly do to fix it.

In a nutshell I am trying to click the button in the flpCategories, and have the dgvItems sort listing only the Item_category that matches the button.text property.

Is This A Good Question/Topic? 0
  • +

Replies To: Filter XML in DataGridView from button.text property

#2 Taledus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 05-October 12

Re: Filter XML in DataGridView from button.text property

Posted 06 October 2012 - 02:46 PM

Update: I decided to drop this method of storing everything in XML files for storing everything in an Access file. I am now using a Fillby to properly sort the category items.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1