* Add items to oleFirst treeview control Thisform.LockScreen = .T. With Thisform.OleFirst .Visible = .F. .Nodes.Clear .Nodes.Add(, 4, "FirstNode1", arAptFirst[1], "pinin") For i = 2 To Alen(arAptFirst) firstnode = "FirstNode"+Alltr(Str(m.i)) .Nodes.Add(, 4, firstnode, arAptFirst[m.i], "pinout", ) Endfor .Visible = .T. Endwith Thisform.LockScreen = .F.OTOH it sounds to be unnecessary to clear nodes first since you're assigning the same node.keys each time. Changing only text and adding-removing nodes as necessary sounds to be a faster way and might totally eliminate the need to play with visibility :
* Add items to oleFirst treeview control With Thisform.OleFirst For ix=1 To Alen(arAptFirst) firstnode = "FirstNode"+Alltr(Str(m.ix)) If ix > .Nodes.Count .Nodes.Add(, 4, firstnode, arAptFirst[m.ix], ; Iif(ix=1,"pinin","pinout") ) Else .Nodes(firstnode).Text = arAptFirst[m.ix] Endif Endfor If .Nodes.Count >= ix For ix = .Nodes.Count To ix Step -1 .Nodes.Remove(ix) Endfor Endif EndwithCetin