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.