Results 1 to 2 of 2

Thread: windows treeview problem

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    windows treeview problem

    Hi All,

    I have a windows treeview and when I programatically select a node with :

    MyTreeview.SelectedNode = myNode

    I find that the root node is still highlighted and nothing seems to happen.

    I have some functionality behind the treenode click event and would like to fire this after I change the node selection but am a bit confused,

    I think I have that friday feeling :-(


    Thanks In advance

    Parksie

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: windows treeview problem

    Well if you want something to fire the click event of the treenode then selecting it programmatically is not going to fire a click event is it as that only gets fired when it is clicked
    You can use the AfterSelect event of the treeview to do this instead as this will work whenever a new node is selected no matter how it was selected.

    Oh yeah and set the HideSelection property of the TreeView to false if you still want to be able to see which node is selected when the treeview doesnt have focus

    EDIT: OK AfterSelect doesnt seem to work either... let me have a play around and get back to you

    EDIT EDIT: Alright! AfterSelect does work, I was just being stupid and selecting the treenode the wrong way.
    I suspect you are just not selecting the node in the correct way either. Can you show more of your code? mainly the bit where this MyNode comes from?
    Last edited by chris128; Feb 6th, 2009 at 06:25 AM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


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