Hi,
Add a new node for each record. Here is an example.
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Dim ds As New DataSet
Dim dvCustomers As DataView
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim conn As SqlConnection
Dim daCustomers As SqlDataAdapter
Dim daOrders As SqlDataAdapter
Dim strConn As String
strConn = "Data Source = " + SystemInformation.ComputerName
strConn += "\VSdotNet; Initial Catalog = NorthWind;"
strConn += "Integrated Security = SSPI;"
conn = New SqlConnection(strConn)
daCustomers = New SqlDataAdapter("Select * from Employees order by LastName,
FirstName", conn)
daCustomers.Fill(ds, "Clients")
dvCustomers = New DataView(ds.Tables("Clients"))
AddNodes()
End Sub
Private Sub AddNodes()
Dim drCustomer As DataRowView
Dim root As System.Windows.Forms.TreeNode
Dim strName As String
With trvNorthWind
..BeginUpdate()
..Nodes.Clear()
For Each drCustomer In dvCustomers
strName = drCustomer.Item("FirstName") & " " & drCustomer.Item("LastName")
Dim n As TreeNode
n = New TreeNode(strName)
Dim snCountry As TreeNode
Dim snCity As TreeNode
snCity = New TreeNode(drCustomer.Item("City"))
snCountry = New TreeNode(drCustomer.Item("Country"))
snCountry.Nodes.Add(snCity)
n.Nodes.Add(snCountry)
trvNorthWind.Nodes.Add(n)
Next drCustomer
..EndUpdate()
End With
End Sub
End Class
Ken