I am searching a XML file for <Asset_Number> and then
adding all children to DataGridView1,
i can search but i dont know how to add item to the DataGridView
Also my datagridview columns are created from a txt file
this is what i have.....
this is my XML
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<items>
<Description>Description</Description>
<Asset_Number>Asset Number</Asset_Number>
<Asset_Type>Asset Type</Asset_Type>
<Location>Location</Location>
</items>
<items>
<Description>Laminator</Description>
<Asset_Number>MOA81</Asset_Number>
<Asset_Type>Electrical</Asset_Type>
<Location>ADMINISTRATION OFFICE</Location>
</items>
</DocumentElement>
Expand|Select|Wrap|Line Numbers
- Dim items As DataSet = New DataSet()
- Dim count As Integer
- Dim a As Integer
Expand|Select|Wrap|Line Numbers
- items.ReadXml((Application.StartupPath) & "\electrical_DB.xml", XmlReadMode.Auto)
- count = items.Tables(0).Rows.Count
- Call find()
Expand|Select|Wrap|Line Numbers
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- 'XML search
- Dim b As Integer
- For b = 0 To (count - 1)
- If items.Tables(0).Rows(b).Item("Asset_Number").ToString.ToUpper Like ((txtBarCode.Text.ToUpper) & "*") Then
- a = b
- Call find()
- Exit For
- End If
- Next
- End Sub
Expand|Select|Wrap|Line Numbers
- Sub find()
- 'this is where im stuck
- 'i want the whole found node displayed in DataGridView1
- ' but this doesnt work
- DataGridView1.datasource = items.Tables(0).Rows(a).Item("Asset_Number")
- End Sub
learning
Thanks in advanced
Gobble.