Why can't the treeview function?? Please Help
VB Code:
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 = 2 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 = 1
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
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
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?
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...
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.
Re: Why can't the treeview function?? Please Help
Quote:
Originally Posted by tauhu82
VB Code:
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 = 2 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 = 1
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
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!
Re: Why can't the treeview function?? Please Help
Is option explicit enabled?
Re: Why can't the treeview function?? Please Help
Where do you set the value of strKey?
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.