I have a context menu, and it is assigned to only a certain level of nodes. Also the functions in the context menu execute correctly, the problem is they don't execute on the correct node. It is always the previously selected node, so if I want it to work correctly I have to left click on the node, then right click on it and it everything is peachy-keen.
Alright, here is the code I have for one of the context menu strips:
Private Sub DuplicateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DuplicateToolStripMenuItem.Click Dim node As TreeNode node = Me.TreeView1.SelectedNode <--- I am pretty sure THIS is the problem 'More unrelated code here End Sub
As I said I already knew there was a problem so here is how I fixed it before:
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick Dim item As String Dim selected As String = "" Dim i As Integer = 0 selected = TreeView1.GetNodeAt(New Point(e.X, e.Y)).Text 'More unrelated code here End Sub
However that is not a viable option as i am not getting the variable e as a TreeNodeMouseClickEvenArgs
Alright, if I was not clear enough (which I am sure that is the case) just post any further questions and I will answer them as quickly as I can. Thanks for any future help (and you can be sure you will get a thanks )
This post has been edited by MrWobbles: 11 February 2009 - 07:40 AM