treeview on click (1 Viewer)

patrickS

New member
Local time
Today, 15:45
Joined
Nov 22, 2020
Messages
4
Hi, hoping there is a little advice out there on an issue, whenever I click on a treeview node (FIR THE FIRST TIME) it always highlights and opens a treeview node above it, i then have to reclick the original lower down node to get to it, this usaully takes a second or third click to actually get to the one i want, once i get three i get to any node i want first time every time, but then i i reload the form, same problem.

. I actually when i click on a node the first time would like that node to be the one that gets the focus the forst timenot a second or third time

Can anyone tell me what i might be doing wrong, perhaps it is in the original set up forthe treeview, I am using msaccess 2016 and hence vba (32 bit)

thanks

Pat
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:15
Joined
May 7, 2009
Messages
19,233
it is on how you populate your treeview.
add this to your form, to check if you are getting the correct node.
note that you need to replace "tvControl" with the name of your treeview:
Code:
Private Sub tvControl_NodeClick(ByVal Node As Object)

On Error GoTo ErrorHandler

Dim strMessage As String

    strMessage = "You've clicked on a node." & vbCrLf & _
        "Key = " & Node.key & vbCrLf & _
        "Text = " & Node.Text & vbCrLf & _
        "FullPath = " & Node.FullPath

    MsgBox strMessage

cleanup:
    Exit Sub

ErrorHandler:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume cleanup

End Sub
 

patrickS

New member
Local time
Today, 15:45
Joined
Nov 22, 2020
Messages
4
it is on how you populate your treeview.
add this to your form, to check if you are getting the correct node.
note that you need to replace "tvControl" with the name of your treeview:
Code:
Private Sub tvControl_NodeClick(ByVal Node As Object)

On Error GoTo ErrorHandler

Dim strMessage As String

    strMessage = "You've clicked on a node." & vbCrLf & _
        "Key = " & Node.key & vbCrLf & _
        "Text = " & Node.Text & vbCrLf & _
        "FullPath = " & Node.FullPath

    MsgBox strMessage

cleanup:
    Exit Sub

ErrorHandler:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume cleanup

End Sub
thanks, i will plug it in

pat
 

Users who are viewing this thread

Top Bottom