created a class to hold my XML DOM data.
visual basic
code:--------------------------------------------------------------------------------Public Class Settings
Public Shared xmlDoc As XmlDocument
Public Shared Property thexml() As XmlDocument
Get
If xmlDoc Is Nothing Then
Dim xmlFile As String = xmlLocation()
Dim xmlDoc As XmlDocument
xmlDoc = New XmlDocument
xmlDoc.Load(xml File)
End If
Return xmlDoc
End Get
Set(ByVal Value As XmlDocument)
xmlDoc = Value 'no real need to validate
End Set
End Property
End
Class--------------------------------------------------------------------------------
I am trying to get it to display the id field in a combobox I am not sure
how to do this. I tried this but I was getting some nullexception error.
visual basic
code:-------------------------------------------------------------------------------- Dim xDoc As Settings
xDoc = New Settings
Dim xNodeList As XmlNodeList
Dim xNode As XmlNode
Dim xDoc2 = xDoc.thexml
xNodeList = xDoc2.SelectNod es("/products/product/id")
For Each xNode In xNodeList
cmbProducts.Ite ms.Add(xNode.In nerText)
Next--------------------------------------------------------------------------------
here is my xml in caase it makes a difference...
Code:
<?xml version="1.0" encoding="utf-8" ?>
<products>
<!-- Repeat the structure below for each product. -->
<product>
<id>CP-90, T-32</id>
<company>Carwel l</company>
<address>Stre et Address</address>
<city>City</city>
<state>State</state>
<zip>Zip</zip>
</product>
<!-- Next product here-->
</products>
Please help, I am at a total loss.....
visual basic
code:--------------------------------------------------------------------------------Public Class Settings
Public Shared xmlDoc As XmlDocument
Public Shared Property thexml() As XmlDocument
Get
If xmlDoc Is Nothing Then
Dim xmlFile As String = xmlLocation()
Dim xmlDoc As XmlDocument
xmlDoc = New XmlDocument
xmlDoc.Load(xml File)
End If
Return xmlDoc
End Get
Set(ByVal Value As XmlDocument)
xmlDoc = Value 'no real need to validate
End Set
End Property
End
Class--------------------------------------------------------------------------------
I am trying to get it to display the id field in a combobox I am not sure
how to do this. I tried this but I was getting some nullexception error.
visual basic
code:-------------------------------------------------------------------------------- Dim xDoc As Settings
xDoc = New Settings
Dim xNodeList As XmlNodeList
Dim xNode As XmlNode
Dim xDoc2 = xDoc.thexml
xNodeList = xDoc2.SelectNod es("/products/product/id")
For Each xNode In xNodeList
cmbProducts.Ite ms.Add(xNode.In nerText)
Next--------------------------------------------------------------------------------
here is my xml in caase it makes a difference...
Code:
<?xml version="1.0" encoding="utf-8" ?>
<products>
<!-- Repeat the structure below for each product. -->
<product>
<id>CP-90, T-32</id>
<company>Carwel l</company>
<address>Stre et Address</address>
<city>City</city>
<state>State</state>
<zip>Zip</zip>
</product>
<!-- Next product here-->
</products>
Please help, I am at a total loss.....