How do I set the current node programmatically – simulating what a user would do by clicking on a node?
In particular, my program has a treeview that is built from a database recordset. Clicking a command button adds a new record to the database and to the treeview. That part works fine — the new node appears in the treeview with the text “New”, and it’s entered into the database. Here’s part of the code:
If pbAddAsLeaf Then
Me!axKeywordTree.Nodes.Add _
“k” & rs!parentid, tvwChild, “n” & CStr(!keywordId), “New”
Else
Me!axKeywordTree.Nodes.Add _
“k” & rs!parentid, tvwChild, “k” & CStr(!keywordId), “New”
End If
What I want to do next is to move the focus to the new keyword and have it selected, ready for editing. Found a bit of info on MSDN about moving to a node under C programming, but nothing for Visual Basic.
Thx.