Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET FOCUS on treeview node

Status
Not open for further replies.

2009luca

Programmer
Jul 27, 2013
222
IT
My code:

Private Sub CONTA_COMUNI()

Dim MYNODE As Node
Dim NRTOT As Long

VALORE = "004017"

NRTOT = 0

For Each MYNODE In Me.TreeView1.nodes
If MYNODE.children = 0 Then
NRTOT = NRTOT + 1
ISTAT = Split(MYNODE, "-")(0)
COMUNE = Split(MYNODE, "-")(1)
If ISTAT = VALORE Then
Stop
MYNODE.Selected = True 'Me.TreeView1.nodes(NRTOT)
Exit For
End If
'Me.TreeView1.nodes.SelectedNode = Me.TreeView1.nodes(0) 'whichever index
End If
DoEvents
Next
'Me.LNRC.Caption = Format(NRTOT, "#,##0")
'DoEvents

End Sub

how to set focus (highlight) on node found in if condition?
 
[tt]Me.TreeView1.nodes.SelectedNodeSelectedItem = Me.TreeView1.nodes(0)[/tt] 'whichever index

combo
 
Why does OP never put code within code tags? It's not exactly rocket science.
 
That would require a LOT of effort on OP, which is too much to ask and OP is not willing to do.

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Rick998 said:
Why does OP never put code within code tags?
Well, occasionally it happens: thread222-1795724 or thread222-1826154

combo
 
2 (two) examples out of 236 posts and 390 replies...
I am not impressed.
[thumbsdown]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Makes it worse in some ways, as it shows 2009luca/sal21 know how to do it, but does not bother.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top