I need to share the xmlDocument object between forms, if possible:
Form 1 or frmMain:
Public doc As New XmlDocument()
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
doc.Load(xmlPath)
Call FillServerList()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Form 2:
Dim MainForm As frmMain
Dim xmlroot As XmlElement = MainForm.doc.DocumentElement
Get an object not referenced error. Any help would be greatly appreciated. If I can do this I can prevent from having to load multiple copies of the same xml file into memory


Reply With Quote