467,885 Members | 1,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 developers. It's quick & easy.

How to Populate tree view object ???

Dear all,

I have the configuration part of my application which will
handle different element configuartion based on tree view
object similar as MMC and snap in.

Configuration data are retrive and save in a local
database for each component.

What is the best way to populate my tree view control.
Is there a easy way to map them to a dataset or XML file?

what is the best and simple.

thnaks for your reply
serge

Jul 21 '05 #1
  • viewed: 4766
Share:
1 Reply
I'm doing it from a dataset, loading the XML file first.
(called DsEdit in this code snippet).
LcFilename as the name of an XML file.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''

' Create a FileStream object with the file path
and name.
Dim myFileStream As New System.IO.FileStream
(lcFilename, System.IO.FileMode.Open)
' Create a new XmlTextReader object with the
FileStream.
Dim myXmlTextReader As New System.Xml.XmlTextReader
(myFileStream)
' Read the data into the DataSet and close the
reader.
DsEdit.ReadXml(myXmlTextReader)
myXmlTextReader.Close()

TreeView1.Nodes.Clear()
Dim t As DataTable
Dim r As DataRow
Dim c As DataColumn
For Each t In DsEdit.Tables
Dim Tablenode As New TreeNode(t.TableName)
TreeView1.Nodes.Add(Tablenode)
Tablenode.ImageIndex = 0
Tablenode.SelectedImageIndex = 1
Dim FieldNode As TreeNode
For Each c In t.Columns
FieldNode = Tablenode.Nodes.Add
(c.ColumnName)
FieldNode.ImageIndex = 2
FieldNode.SelectedImageIndex = 2
FieldNode.Tag = Tablenode.Text
Next
Next
c = Nothing
r = Nothing
t = Nothing

'''''''''''''''''''''''''''''''''
Good luck
Moose
-----Original Message-----
Dear all,

I have the configuration part of my application which willhandle different element configuartion based on tree view
object similar as MMC and snap in.

Configuration data are retrive and save in a local
database for each component.

What is the best way to populate my tree view control.
Is there a easy way to map them to a dataset or XML file?

what is the best and simple.

thnaks for your reply
serge

.

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tree menu using XML | last post: by
1 post views Thread by RickDee | last post: by
3 posts views Thread by Saradhi | last post: by
4 posts views Thread by Mike | last post: by
1 post views Thread by serge calderara | last post: by
5 posts views Thread by Pavan | last post: by
3 posts views Thread by aine_canby | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.