Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
Posts
176
Stupid scrollbar when using a treeview
Whenever i place a treetriew in a project, a horizontal scrollbar apears. It's not needed, it looks ugly and i can't get ridd of it... Anyone has a sollution?
This more of workaround and I'm sure there is someway to totally eliminate the scrollbar.
Try in your Form_Load event
TreeView1.ExpandAll()
TreeView1.CollapseAll()
It eliminates the horizontal scroll unless the tree expands beyond the borders of the control. This way you can still have the vertical scroll and only have the HScroll when necessary.
It appears if you load your nodes at runtime, the scrollbar does not show
Dim i As Integer
For i = 0 To 20
Dim nd As New TreeNode()
nd.Text = "node" & i.ToString
If i Mod 4 = 0 Then
Dim nd2 As New TreeNode()
nd2.Text = "child" & i
nd2.Checked = True
nd.Nodes.Add(nd2)
End If
TreeView1.Nodes.Add(nd)
Next
Let me know if this doesn't work. This is the only way I can consistantly NOT have the HScroll.