473,769 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Select edIndexChanged( object sender, System.EventArg s e)
{
string selected;
selected = this.listBox1.S electedItem.ToS tring();

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

Any ideas.

Greetings Rasmus Madsen
Nov 15 '05 #1
1 15550
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.publi c.dotnet.langua ges.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**********@go ogle.com
NNTP-Posting-Date: Mon, 17 Nov 2003 11:54:22 +0000 (UTC)
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.s yr.edu!news.max well.syr.edu!po stnews1.google. com!no
t-for-mailXref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1998 23
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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_Select edIndexChanged( object sender, System.EventArg s e){
string selected;
selected = this.listBox1.S electedItem.ToS tring();

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

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
2127
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, I do: widget.set_property("can-focus", gtk.FALSE) My problem is a TreeView which has a clickable column, it get the default focus and I did not find how to forbid that.
2
2420
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 that count in a stringcollection which is in viewstate.The count is wrong after certain checks and click of the button.can any one explain what could be wrong.
1
2175
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 Control with checkbox)
3
2256
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 child node or a leaf node then a DataGrid is populated based on the node's ID property. If I expand a node then the DataGrid is not populated. This works fine. The problem is that this doesn't work if I collapse the tree. If I collapse the tree...
1
6369
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 stay on the control, but instead jumps back to the treeview. I'm setting the focus in the AfterSelect event of the treeview, and if I step through the code the desired control does have .Focused = True after I have set it, but then somewhere after...
3
11636
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 I am having is that when a node is selected it snips the text to the length of the text minus the length of the extra icon. Is there a way to redefine the selection box size for each node? The DrawNode code is as follows :
8
5635
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 sender, DrawTreeNodeEventArgs e) { e.Graphics.DrawString(e.Node.Text, e.Node.TreeView.Font, Brushes.Black, e.Bounds.Left, e.Bounds.Top); }
1
1507
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 page, when i select a node in treeview it redirects to N page, its ok, but i want each time i select a page in the treeview it expand the tree to current node selected, i can't do it, each time i select a node, treeview appears as originally i...
0
1419
by: liliya | last post by:
Hi, How can I set focus to TreeView selected node is ASP 2.0 ,VB Thank you.
0
1274
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, treeview is loading the data as it should, but selecting the first node, which I guess is why the afterselect is firing. Regards Robert
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.