Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I have few question regarding using Treeview in my project. The screen of my project is been attched.

I can populate the data from database in treeview using following code:
[code]
VB
Imports System.Data.SqlClient
Public Class Tree

    Private Sub Tree_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dsTest As DataSet
        Dim cnTest As New SqlClient.SqlConnection("DATA SOURCE=myPC\DBserver;USER ID=sa;PASSWORD=udo5673;INITIAL CATALOG=ZINDAA;")
        Dim daCountry As New SqlClient.SqlDataAdapter("SELECT CsCountryCode,CsCountryName from hrCountrySetup", cnTest)
        dsTest = New DataSet()
        cnTest.Open()
        daCountry.Fill(dsTest, "dtCountry")
        cnTest.Close()

        TreeView1.Nodes.Clear()
        Dim parentrow As DataRow
        Dim parenttable As DataTable
        parenttable = dsTest.Tables("dtCountry")
        For Each parentrow In parenttable.Rows
            Dim parentnode As New TreeNode
            parentnode = New TreeNode(parentrow.Item(0) & " - " & parentrow.Item(1))
            TreeView1.Nodes.Add(parentnode)
        Next parentrow
    End Sub
End Class
[/code]

now with my treeview, i want to fill my texbox1,textbox2 with the value of treeview node when user selects the treeview node.

I could get idea on how to. CAN ANYONE HELP ME?
Posted
Updated 6-Apr-12 4:57am
v2
Comments
Corporal Agarn 6-Apr-12 10:58am    
Edit for code formating

1 solution

Here[^] you'll find an answer with examples. The source of data is unimportant, irrelevant.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900