Hello Folks,
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 "?>
<DocumentElemen t>
<items>
<Description>De scription</Description>
<Asset_Number>A sset Number</Asset_Number>
<Asset_Type>Ass et Type</Asset_Type>
<Location>Locat ion</Location>
</items>
<items>
<Description>La minator</Description>
<Asset_Number>M OA81</Asset_Number>
<Asset_Type>Ele ctrical</Asset_Type>
<Location>ADMIN ISTRATION OFFICE</Location>
</items>
</DocumentElement >
any help would be greatly appreciated , please forgive me as i am just
learning
Thanks in advanced
Gobble.
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 "?>
<DocumentElemen t>
<items>
<Description>De scription</Description>
<Asset_Number>A sset Number</Asset_Number>
<Asset_Type>Ass et Type</Asset_Type>
<Location>Locat ion</Location>
</items>
<items>
<Description>La minator</Description>
<Asset_Number>M OA81</Asset_Number>
<Asset_Type>Ele ctrical</Asset_Type>
<Location>ADMIN ISTRATION OFFICE</Location>
</items>
</DocumentElement >
Code:
Dim items As DataSet = New DataSet()
Dim count As Integer
Dim a As Integer
Code:
items.ReadXml((Application.StartupPath) & "\electrical_DB.xml", XmlReadMode.Auto)
count = items.Tables(0).Rows.Count
Call find()
Code:
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
Code:
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.
Comment