The + appears only if the node has children. In your situation, that
condition is not true. I'd suggest you need to cheat a little, ie add in a
dummy child node that is refreshed when the node is selected. Try this as a
starter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.TreeView1.Nodes.Clear()
Me.TreeView1.Nodes.Add("Root Node 1")
Me.TreeView1.Nodes(0).Nodes.Add("DummyNode")
Me.TreeView1.Nodes.Add("Root Node 2")
Me.TreeView1.Nodes(1).Nodes.Add("DummyNode")
Me.TreeView1.Nodes.Add("Root Node 3")
Me.TreeView1.Nodes(2).Nodes.Add("DummyNode")
End Sub
Private Sub GetCorrectChildNodes()
Dim tnRootNode As TreeNode
tnRootNode = Me.TreeView1.SelectedNode
tnRootNode.Nodes.Clear()
Dim tnNewNode As TreeNode
tnNewNode = New TreeNode("Child Node 1")
tnRootNode.Nodes.Add(tnNewNode)
End Sub
Private Sub TreeView1_BeforeExpand(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeExpand
Me.TreeView1.SelectedNode = e.Node
GetCorrectChildNodes()
End Sub
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:uC**************@TK2MSFTNGP14.phx.gbl...
I asked this months ago, and never received a reply. Here I go again...
I have a treeview on a Windows Form. I only want to retrieve the top-most
nodes' data from the DB initially. As the user clicks to expand a node, I
will then retrieve its children. Therein lies the problem: I cannot
create a node that displays the plus symbol for the user to click upon.
Can anyone shed some light, please.
Desparate,
Tim