Microsoft Treeview Nodes.AddRange

Have you ever tried to add nodes in the Microsoft Treeview using the AddRange method, it is not fun to do that as you cannot create a new TreeNodeCollection.After doing quite a bit of research we found a way to do this.Here is the trick.

vb.net sample code:

Dim ndc as new list(of TreeNode)

For i as Integer = 0 to 10 step 1
Dim nd as new TreeNode
nd.text = "node " + i.tostring
ndc.add(nd)
Next 1

Me.treeview1.Nodes.AddRange(ndc.ToArray)

Comments

Popular posts from this blog

Duplicate Folders Freeware - Not Duplicate Files

SSRS Compile Errors

Free SQL Server Management Studio Addin/Plugin/External Tool to get object information quickly