364,033 Members | 4753 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Simple question on Treeview?

Peter
P: n/a
Peter
Hello

Thanks for reviewing my question. I would like to know how can I programmatically select a node

Thanks in Advanc
Peter
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


John Kn [MS]
P: n/a
John Kn [MS]
Peter,

If it is the TreeView Control; try this
Gets or sets a TreeNode object that represents the selected node in the
TreeView control. Please start here"
http://longhorn.msdn.microsoft.com/l...webcontrols/c/
treeview/p/selectednode.aspx

<%@ Page Language="C#" %>

<script runat="server">

void SpacingIndex_Changed(Object sender, EventArgs e)
{

// Set the vertical spacing of the selected node based on the value
selected by the user.
LinksTreeView.SelectedNodeStyle.VerticalPadding =
Convert.ToInt32(SpacingList.SelectedItem.Text);

}

void ColorIndex_Changed(Object sender, EventArgs e)
{

// Set the foreground (font) color of the selected node based on
the value selected by the user.
LinksTreeView.SelectedNodeStyle.ForeColor =
System.Drawing.Color.FromName(ColorList.SelectedIt em.Text);

}

void Select_Change(Object sender, EventArgs e)
{

Message.Text = "You selected: " + LinksTreeView.SelectedNode.Text;

}

--------------------[color=blue]
>Thread-Topic: Simple question on Treeview?
>thread-index: AcQCF4+B4d7YB7S9Tay6VlBKJ7Y7hQ==
>X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
>From: "=?Utf-8?B?UGV0ZXI=?=" <anonymous@discussions.microsoft.com>
>Subject: Simple question on Treeview?
>Date: Thu, 4 Mar 2004 10:36:08 -0800
>Lines: 6
>Message-ID: <4918A61A-5FC1-4540-874C-A4DB65B1ECBD@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.languages.csharp
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:226424
>NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
>X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
>
>Hello,[/color]

Thanks for reviewing my question. I would like to know how can I
programmatically select a node?

Thanks in Advance
Peter[color=blue]
>[/color]

Cheers,

johnKn [MS-SDK]



-Please do not send email directly to this alias. This alias is for
newsgroup purposes only


-This posting is provided “AS IS” with no warranties, and confers no rights.



-To provide additional feedback about your community experience please send
e-mail to: sdkcomm@microsoft.com

Nov 15 '05 #2

Peter
P: n/a
Peter
John

First, I am using a Treeview in a form. Next, I you might misunderstood my question. I want to select a specific node not find out which node is selected. I know I can find the selected node by the property .SelectedNode. Any clues

Many Thank
Peter
Nov 15 '05 #3

Michael A. Covington
P: n/a
Michael A. Covington
> First, I am using a Treeview in a form. Next, I you might misunderstood
my question. I want to select a specific node not find out which node is
selected. I know I can find the selected node by the property
..SelectedNode. Any clues?

Why not simply set SelectedNode to point to the node you want? I could be
wrong, but I think that's all you have to do.

Remember, each of the nodes is really a pointer... so is SelectedNode.



Nov 15 '05 #4

Post your reply

Help answer this question



Didn't find the answer to your C# / C Sharp question?

You can also browse similar questions: C# / C Sharp