Results 1 to 8 of 8

Thread: Why can't the treeview function?? Please Help

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    Exclamation Why can't the treeview function?? Please Help

    VB Code:
    1. Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    2.  
    3. If strKEy <> "" Then
    4. If TreeView1.Nodes(strKEy).Parent Is Nothing Then
    5.  
    6. If Button = 2 Then ' if the mousebutton 2 is pressed (right)
    7. PopupMenu rclick ' then it calls the menu which is hidden to be shown
    8. ' at the cordinates of the mousepointer (x,y)
    9.  
    10. Else
    11.  
    12. Button = 1
    13. RemoteHost = TreeView1.Nodes(strKEy).Text
    14. sckControlPanel.RemoteHost = RemoteHost
    15. sckControlPanel.RemotePort = 8005
    16. sckControlPanel.Connect
    17.  
    18. End If
    19. End If
    20. Else
    21.  
    22. sckControlPanel.Close
    23. Call sckControlPanel_Close
    24.  
    25. End If
    26.  
    27. Data1.Refresh
    28. End Sub
    This is the code i used in the treeview but i all the function which i put in can't function for example the right click pop up or even the left click to make the connection can;t even work. Please can anyone help me..
    Thanks alot in advance
    Last edited by Hack; Mar 3rd, 2006 at 01:12 PM. Reason: Added [vbcode] [/vbcode] tags and for more clarity.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Why can't the treeview function?? Please Help

    What happens when you try?

    Are you getting error messages? If so, what are they and on what line to they occur?

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    No nothing is happening...

    The problem is nothing is happening... No error message or anything.. i can click but nothing is happening. Anyone have any idea?? Please help me ok Thanks in advance...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Why can't the treeview function?? Please Help

    Put a break at the beginning of the sub and using F8 "walk" through it to see what is happening.

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Why can't the treeview function?? Please Help

    Quote Originally Posted by tauhu82
    VB Code:
    1. Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    2.  
    3. If strKEy <> "" Then
    4. If TreeView1.Nodes(strKEy).Parent Is Nothing Then
    5.  
    6. If Button = 2 Then ' if the mousebutton 2 is pressed (right)
    7. PopupMenu rclick ' then it calls the menu which is hidden to be shown
    8. ' at the cordinates of the mousepointer (x,y)
    9.  
    10. Else
    11.  
    12. Button = 1
    13. RemoteHost = TreeView1.Nodes(strKEy).Text
    14. sckControlPanel.RemoteHost = RemoteHost
    15. sckControlPanel.RemotePort = 8005
    16. sckControlPanel.Connect
    17.  
    18. End If
    19. End If
    20. Else
    21.  
    22. sckControlPanel.Close
    23. Call sckControlPanel_Close
    24.  
    25. End If
    26.  
    27. Data1.Refresh
    28. End Sub
    This is the code i used in the treeview but i all the function which i put in can't function for example the right click pop up or even the left click to make the connection can;t even work. Please can anyone help me..
    Thanks alot in advance
    Also make it easier on yourself (or the guy who needs to maintain your code) and indent!

  6. #6
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Why can't the treeview function?? Please Help

    Is option explicit enabled?

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Why can't the treeview function?? Please Help

    Where do you set the value of strKey?

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    Exclamation Re: Why can't the treeview function?? Please Help

    Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    strKEy = Node.Key
    End Sub

    Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)

    If strKEy = "" Then
    If TreeView1.Nodes(strKEy).Parent Is Nothing Then

    If (Button = vbRightButton) Then ' if the mousebutton 2 is pressed (right)
    'PopupMenu rclick ' then it calls the menu which is hidden to be shown
    ' at the cordinates of the mousepointer (x,y)

    Else

    Button = vbLeftButton
    RemoteHost = TreeView1.Nodes(strKEy).Text
    sckControlPanel.RemoteHost = RemoteHost
    sckControlPanel.RemotePort = 8005
    sckControlPanel.Connect

    End If
    End If
    Else

    sckControlPanel.Close
    Call sckControlPanel_Close

    End If

    Data1.Refresh
    End Sub

    Private Sub Form_Activate()
    On Error Resume Next 'just to make sure run-time error will not occur
    strKEy = TreeView1.SelectedItem.Key
    On Error GoTo 0
    End Sub

    Yes the option explicit is already enable. If anyone can help me please do so Thanks alot inadvance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width