Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Preventing First Node of a TreeView from being auto-selected?

$
0
0
I have a treeview on a form. I'm just playing around with it because I've never really used the control before. I noticed that after adding a single node in design mode, I run the app and that single node is selected. How can I prevent that? Here is my code below.

Code:

    Private Sub LoadAccounts()
        Try
            Dim strValue As String = "CHART OF ACCOUNTS (Double Click Title to add Accounts/Sub Accounts)"
            Dim node1 As New TreeNode
            Dim f As Font = New Font("Arial", 10, FontStyle.Bold)

            node1.ForeColor = Color.Navy
            node1.Text = strValue
            node1.NodeFont = f
            trvw.Nodes.Add(node1)
            trvw.ShowLines = False

        Catch ex As Exception
           
        End Try
    End Sub

Thanks,

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>