Software Design Question

fremenusul

New member
Joined
Mar 14, 2005
Messages
2
Programming Experience
Beginner
I am building a application that uses XML data to display prducts.

Currently, I have a class that holds the XML data.

Imports System.Xml

Public Class Settings

Private Shared xmlDoc As XmlDocument

Public Shared Property Products() As XmlDocument
Get
If xmlDoc Is Nothing Then
Dim xmlFile As String = xmlLocation()
Dim xmlDoc As XmlDocument

xmlDoc = New XmlDocument
xmlDoc.Load(xmlFile)
End If

Return xmlDoc
End Get
Set(ByVal Value As XmlDocument)

End Set
End Property

End Class

Here is where my problem begins. I have a form that has a combobox that will
display some of the xml data. If someone needs to add data a new form pops up
and they add data to the memory (xml). Then it saves the new XML file.

If they close the "add products" form, the combobox is NOT updated with the
new information. How can I have the combobox read the XML data (in memory)?

PS: here is how I was doing it before I added a class to hold XML data.
Private Sub Zadig_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Dim xmlTr As New XmlTextReader(xmlFile)

'While xmlTr.Read
' If xmlTr.Name = "id" AndAlso xmlTr.NodeType =
XmlNodeType.Element Then
' cmbProducts.Items.Add(xmlTr.ReadString)
' End If
'End While
'xmlTr.Close()

'xmlDoc = New XmlDocument
'xmlDoc.Load(xmlFile)

End Sub

I dont think I can do it in the "load" area because it is only loaded once.
I need something that will be "dynamic" with the combobox.
 
Top Bottom