473,794 Members | 2,754 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 15551
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
2423
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
6371
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
11637
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
5637
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
1508
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
1424
by: liliya | last post by:
Hi, How can I set focus to TreeView selected node is ASP 2.0 ,VB Thank you.
0
1275
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
9671
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
9518
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
10433
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
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...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.