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?
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?