Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Posts
    74

    Unanswered: Help with TreeView update

    I have two questions:

    1) I am deleting records from a table that feeds a TreeView. I am trying to reposition my displayed selection to the record before the deleted item. I can successfully set the current ".SelectedItem" to the ".SelectedItem.Previous" Node. When I update the TreeView after deleting the record (to get the deleted record out of the picture), I lose my selection, and can't get the previous node to be highlighted anymore. The TreeView object has the focus when I set the ".SelectedItem" value. How can I get the repositioned selected node to appear in the TreeView?

    2) Where is a good resource for reading up on how to work with TreeViews? I'm new to this ...

    Thanks!
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    There's some treeview examples I found on this site which may help: http://www.access-programmers.co.uk/...er=desc&page=3

    I didn't see any documentation other than some sample mdb's you could download.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    May 2007
    Posts
    74
    Thanks for the link, pkstormy! There looks like there could be some interesting stuff to learn from the TreeView2000 database.

    Does anybody have any ideas on my Question (1)? I would have expected that just giving the TreeView object the Focus, and setting the .SelectedItem node value would highlight (and showon the screen) that selected node.

    I didn't see anything that could help from the sample databases that pkstormy pointed to ...
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  4. #4
    Join Date
    Jun 2007
    Posts
    33
    Set oTree = Me!TreeCtl.Object
    set nodCurrent = oTree.SelectedItem
    NewNodCurrent= (nodCurrent.Index) + 1 'next node or set other node
    oTree.Nodes.Remove nodCurrent.Index ' deleted record/node

    oTree.Nodes.Item(NewNodCurrent).Selected = True
    Hope it helps

Posting Permissions

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