
Adding a node to a treeview from a different thread
The documentation on it is poor, and is confusing. however i managed to get
it working as follows:
' At the top of my form I declare the invoker sub:
Public Delegate Sub TreeInvoker(ByVal key As String)
' When I want to add a tree node from within a worker thread,
' I call the invoker sub as follows, always passing the params as an
' array even when there's only one.
Dim params() As Object = {key}
Me.Invoke(New TreeInvoker(AddressOf Me.AddClientNode), params)
' This is the GUI sub
Private Sub AddClientNode(ByVal key As String)
Dim n As New Infragistics.Win.UltraWinTree.UltraTreeNode()
n.Text = key
n.LeftImages.Add(3)
n.Key = key
n.Selected = False
ultTree.Nodes.Add(n)
End Sub
Sam