2
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by AndreRet
0

Use 'SelectedNode.Parent.Text'. If you are storing a value in the
node's 'Tag' property, use 'SelectedNode.Parent.Tag.ToString()' to convert
the value to a string -

txtValue.Text = tvMyTreeview.SelectedNode.Parent.Text

You will have something like this if you are using checkboxes in your treeview -

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
2
        For Each tn As TreeNode In Me.TreeView1.CheckedNodes
3

4
            Dim s As String = tn.Value
5
            TextBox1.Text += s & ","
6

7
        Next
8
    End Sub

Edited by AndreRet

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.