Batool

how can i fill a treeview using xml data source in a windows application

thx




Re: Windows Forms Data Controls and Databinding bind TreeView using xml

Ken Tucker

How to populate a treeview from a dataset

http://support.microsoft.com/kb/320755

Extending the TreeView control

http://msdn2.microsoft.com/en-us/library/ms996437.aspx






Re: Windows Forms Data Controls and Databinding bind TreeView using xml

Batool

Dim parentrow As DataRow

Dim ParentTable As New DataTable

Dim DsMenuPrograms As DataSet

Dim objDB As New clsDatabase

Dim strSQl As String = "SELECT [ProgramId],[ProgramName],[ParentId]" & _

" FROM [MenuPrograms] Where [ParentId] = " & inParentID

DsMenuPrograms = objDB.dsCreateDataSet(strSQl)

ParentTable = DsMenuPrograms.Tables(0)

For Each parentrow In ParentTable.Rows

Dim parentnode As System.Windows.Forms.TreeNode

parentnode = New System.Windows.Forms.TreeNode(parentrow.Item(1))

inTreeNode.Nodes.Add(parentnode)

parentnode.Tag = parentrow.Item(0)

PopulateTreeView(parentrow.Item(0), parentnode)

Next parentrow

End Sub

i wrote the above code ,but what i need is to fill or bind the treeview control from XML file






Re: Windows Forms Data Controls and Databinding bind TreeView using xml

Zhi-Xin Ye - MSFT

Check this project:

Loading and Saving XML to and from a TreeView Control