Public Sub LoadFromXML(ByVal strXMLFile As String)
Dim nodElement As New TreeNode() 'Create a Generic Element Node
Dim nodParent As New TreeNode() 'Create a Generic Parent Node
' Create and Open DataSet from XML
Dim dsXMLNames As New DataSet("DotNetSend")
dsXMLNames.ReadXml(strXMLFile)
With dsXMLNames.Tables("Groups")
Dim r As DataRow 'Create Generic DataRow
'Loop through all Rows in Group table
For Each r In .Rows
nodParent = New TreeNode()
nodParent.Text = r("Name").ToString()
'nodParent.Expand()
Dim c As DataRow 'Create Generic DataRow
'Loop through all child rows of parent
For Each c In r.GetChildRows("GroupsUsers")
nodElement = New TreeNode()
'Set Node Properties
With nodElement
.Checked = c("Selected").ToString()
.Tag = c("Name").ToString()
.Text = c("Description").ToString()
End With
'Add Child node to Parent
nodParent.Nodes.Add(nodElement)
nodElement = Nothing
Next c
'Add Parent to Treeview
tvUsers.Nodes.Add(nodParent)
nodParent = Nothing
Next r
End With
End Sub