i want to learn treeview handle by database
treeview handle by database
Collapse
X
-
Tags: None
-
Have you guys checked out MSDN's Library on the TreeView Class?
It has a lot of examples in both VB.NET and C#.
Cheers!
-FrinnyComment
-
Hi,
You can have this code to add nodes using db.
[code=vbnet]
Dim con As New OleDbConnection
Dim ds As New DataSet
Dim da As OleDbDataAdapte r
Dim dt As New DataTable
Dim td As TreeNode
Dim td1 As TreeNode
Dim sql As String
con.ConnectionS tring = "Provider=SQLOL EDB.1;......... ..."
con.Open()
sql = "Select .............."
da = New OleDbDataAdapte r(sql, con)
da.Fill(dt)
For i As Integer = 0 To dt.Rows.Count - 1
td = New TreeNode(dt.Row s(i).Item(0))
' To add Parent nodes
TreeView1.Nodes .Add(td)
' To add the child nodes
td1 = New TreeNode(dt.Row s(i).Item(0))
td.Nodes.Add(td 1)
Next
con.Close()[/code]Comment
Comment