Results 1 to 1 of 1

Thread: [RESOLVED] [Help] Treeview Not letting me set a variable inside its sub

  1. #1

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    35

    Resolved [RESOLVED] [Help] Treeview Not letting me set a variable inside its sub

    K So I got the code worked out for what it needs to be but vb seems to be complaining about it.

    is there a way to set a variable inside of a key_up event heres my code:

    Code:
    Private Sub TreeView1_KeyUp(KeyCode As Integer, Shift As Integer)
    Debug.Print TreeView1.SelectedItem.Key
    Debug.Print KeyCode
    If KeyCode = 46 Then
    'remove node from tree as well as remove it from the array using replace
    TreeView1.Nodes.Remove (TreeView1.SelectedItem.Index)
    TextOutPut(Val(TreeView1.SelectedItem.Parent.Key)) = Replace(TextOutPut(Val(TreeView1.SelectedItem.Parent.Key)), TreeView1.SelectedItem.Key & vbCrLf, "") ' Heres the line it keeps complaining about
    End If
    End Sub
    So it appears to be working now even though I didnt change anything. Anyone know what Might have cause this? and now its broken again ***?.... Just noticed I was removing the node and then trying to do stuff with it. ROFL my bad

    I still need help though... How Can I remove the Parent Node When it has no more children? I dont know how to set a variable to a specific node basically I wanna put
    a = treeview.selecteditem.node
    if a.children = 0 remove a

    Anyone got any ideas on how to do this?... Nevermind figured it out again (I was really close just wasnt removing the correct node...)
    Last edited by jasonmbrown; Oct 13th, 2011 at 09:08 AM. Reason: it fixed itself?

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