By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

Simple question on Treeview?

P: n/a
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


P: n/a
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;

}

--------------------
Thread-Topic: Simple question on Treeview?
thread-index: AcQCF4+B4d7YB7S9Tay6VlBKJ7Y7hQ==
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
From: "=?Utf-8?B?UGV0ZXI=?=" <an*******@discussions.microsoft.com>
Subject: Simple question on Treeview?
Date: Thu, 4 Mar 2004 10:36:08 -0800
Lines: 6
Message-ID: <49**********************************@microsoft.co m>
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,
Thanks for reviewing my question. I would like to know how can I
programmatically select a node?

Thanks in Advance
Peter


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: sd*****@microsoft.com

Nov 15 '05 #2

P: n/a
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

P: n/a
> 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

This discussion thread is closed

Replies have been disabled for this discussion.