Hi mBird,
You can select certain TreeNode in this way
<code>
treeView1.HideSelection = false;//show the selection, or there will no
visual effects on selection
//do you own selection algorithm
treeView1.SelectedNode = treeView1.Nodes[1].Nodes[0];
</code>
Does it answer your question?
If you still have questions on this issue, please let me know!
Thanks for using MSDN Newsgroup!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
--------------------
| From: "mBird" <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Subject: c# treeview programatically select a node
| Lines: 14
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Date: Tue, 14 Oct 2003 14:21:48 GMT
| NNTP-Posting-Host: 24.25.180.58
| X-Complaints-To: (e-mail address removed)
| X-Trace: twister.nyroc.rr.com 1066141308 24.25.180.58 (Tue, 14 Oct 2003
10:21:48 EDT)
| NNTP-Posting-Date: Tue, 14 Oct 2003 10:21:48 EDT
| Organization: Road Runner
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!newsfeed.media.kyoto-u.ac.jp!newsfeed2.kddnet.ad.jp!news-east.rr.com!news.rr.com!news-rtr.nyroc.rr.com!news-out.nyroc.rr
com!twister.nyroc.rr.com.POSTED!53ab2750!not-for-mail
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:54399
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I want to be able to programmatically select a node in my treeView:
| So I want to be able to select node Page2,PartNumber1,SubPart2 and have it
| selected so if I do treeView.Selected I will be working with that node (so
| same as if I manually selected it by mouse-clicking it) -- Thank you
|
| Page1
| Page2
| -PartNumber1
| --SubPart1 <select this one
| --SubPart2
| -PartNumber2
|
|
|
|