Tree Control (1 Viewer)

Exodus

Registered User.
Local time
Today, 06:09
Joined
Dec 4, 2003
Messages
317
I am using a tree control as my switchboard/menu system. Is there a way to set the focus to a specific node when the form loads?
 

MarkK

bit cruncher
Local time
Today, 06:09
Joined
Mar 17, 2004
Messages
8,186
Try the selected property of a node, or the selecteditem property of the tree. Set the first to true, set the second to the node you want selected. At least one of those will work.
Mark
 

Exodus

Registered User.
Local time
Today, 06:09
Joined
Dec 4, 2003
Messages
317
Ok how would I implement that?
I have done
Me.TreeCtl.Selected.Node("P|30") = True
Me.TreeCtl.Selecteditem ("P|30")
Niether works Is there some that I am missing?
 

MarkK

bit cruncher
Local time
Today, 06:09
Joined
Mar 17, 2004
Messages
8,186
Code:
Dim Tree As MSComCtlLib.Treeview
Dim Node as MSComCtlLib.Node

[COLOR="Green"]'the treeview activex control is the object in the access customcontrol[/COLOR]
Set Tree = Me.TreeCtl.Object
[COLOR="Green"]'and we can get a node from the nodes collection[/COLOR]
Set Node = Tree.Nodes("SomeNodeKey")

[COLOR="Green"]'to select a node do one of ...[/COLOR]
Node.Selected = True
[COLOR="Green"]' - or -[/COLOR]
Tree.SelectedItem = Node
Does that make sense?
Cheers,
Mark
 

Users who are viewing this thread

Top Bottom