473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Focus to node in treeview

I need to grab focus to a specific node i my treeview when I click on my listbox.
Here's the code that differs between the different event i the listBox:

private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string selected;
selected = this.listBox1.SelectedItem.ToString();

if(selected == "Error in Supercell 1")
{
this.treeView.Focus();
//here I would like to select a specific node i the treeView
}
if(selected == "Error in Job 1")
{
this.treeView.Focus();
}
if(selected == "Error in Welds")
{
this.treeView.Focus();
}
if(selected == "Error in Weld 1222")
{
this.treeView.Focus();
}
}

Any ideas.

Greetings Rasmus Madsen
Nov 15 '05 #1
1 15502
you can use SelectedNode. assign it to the node you want to select:
this.treeView1.SelectedNode = mynode;

thanks,
Mohamed
--------------------
From: st*************@hotmail.com (Rasmus)
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Focus to node in treeview
Date: 17 Nov 2003 03:54:22 -0800
Organization: http://groups.google.com
Lines: 30
Message-ID: <45**************************@posting.google.com >
NNTP-Posting-Host: 130.225.159.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1069070062 18079 127.0.0.1 (17 Nov 2003 11:54:22 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Mon, 17 Nov 2003 11:54:22 +0000 (UTC)
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.google.com!no
t-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:199823
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

I need to grab focus to a specific node i my treeview when I click on my listbox.Here's the code that differs between the different event i the listBox:

private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e){
string selected;
selected = this.listBox1.SelectedItem.ToString();

if(selected == "Error in Supercell 1")
{
this.treeView.Focus();
//here I would like to select a specific node i the treeView
}
if(selected == "Error in Job 1")
{
this.treeView.Focus();
}
if(selected == "Error in Welds")
{
this.treeView.Focus();
}
if(selected == "Error in Weld 1222")
{
this.treeView.Focus();
}
}

Any ideas.

Greetings Rasmus Madsen


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Franck Pommereau | last post by:
Hi all, I'm building a PyGTK interface in which I would like that no widget would be able to get the focus (and so to be activated by pressing the Return key). For this purpose, for each widget,...
2
by: Srinivasa Raghavan | last post by:
Hi I am using ASP Tree View Control to display data in hiearchy fashion.I am having a checkbox next to the TreeView Node.When user checks or unchecks the nodes and click a button i am putting...
1
by: Srinivasa Raghavan | last post by:
Hi All, I have some doubts on the Treeview control and Form Authentication 1) will Form Authentication work if cookies are disabled. 2) I have problem in the following code (TreeView...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
1
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not...
3
by: John | last post by:
I have overridden the default DrawNode (OwnerDrawText mode) to allow me to draw an extra icon at the front of the text block, while still using the built-in icon list for another icon. The problem...
8
by: Jon Slaughter | last post by:
I'm trying to override the default paiting of a treeview but I get bad results: My code(well, atleast this is the most simple that reproduces the result) is this private void TVDrawNode(Object...
1
by: Rick | last post by:
Hi guys! I have a problem with a master page that has a treeview control as menu, i have a root node, 5 parents and each parent has 10 leafs, 50 pages in total, each page is linked to master...
0
by: liliya | last post by:
Hi, How can I set focus to TreeView selected node is ASP 2.0 ,VB Thank you.
0
by: RobcPettit | last post by:
Hi, when my forms loading with the treeview(which lists directories) , the afterselect is firing straight away. I s there a way to stop this happening. When I take the afterselect code out,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.