473,701 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview node set focus question

Kay
Hi all,

Can anyone tell me how do I set focus on a particular treenode at run time?
If you need to know what I'm try to do please read on ...

I have a treeview to represent a Country/Product scenario (i.e. a country,
as parent node, produce 1 to many product, as childnode). When the user
click on one of the node a group of textbox/combo box etc will be populated
and if btnSave is clicked data will then be updated and the treeview will be
reloaded.

I'm trying to "remember" the selected node , it could be parent or child
node, and after the treeview is refreshed I want to set focus to the that
node again. However I can't find the focus method for a node.....anyone
know how?

Thx!

Kay
Nov 23 '05 #1
3 10465
Hi,

You have to set the treeviews selectednode.

http://msdn.microsoft.com/library/de...dnodetopic.asp

Ken
---------------------
"Kay" <kk@micxsoft.co m> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi all,

Can anyone tell me how do I set focus on a particular treenode at run
time? If you need to know what I'm try to do please read on ...

I have a treeview to represent a Country/Product scenario (i.e. a country,
as parent node, produce 1 to many product, as childnode). When the user
click on one of the node a group of textbox/combo box etc will be
populated and if btnSave is clicked data will then be updated and the
treeview will be reloaded.

I'm trying to "remember" the selected node , it could be parent or child
node, and after the treeview is refreshed I want to set focus to the that
node again. However I can't find the focus method for a node.....anyone
know how?

Thx!

Kay

Nov 23 '05 #2
> Can anyone tell me how do I set focus on a particular treenode at run
time? If you need to know what I'm try to do please read on ...

I have a treeview to represent a Country/Product scenario (i.e. a country,
as parent node, produce 1 to many product, as childnode). When the user
click on one of the node a group of textbox/combo box etc will be
populated and if btnSave is clicked data will then be updated and the
treeview will be reloaded.

I'm trying to "remember" the selected node , it could be parent or child
node, and after the treeview is refreshed I want to set focus to the that
node again. However I can't find the focus method for a node.....anyone
know how?


Only TreeView has this method :
TreeView1.Selec tedNode = YourRememberedN ode

HTH, LinasB
Nov 23 '05 #3
Kay
That help! thanks !!

"Kay" <kk@micxsoft.co m> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi all,

Can anyone tell me how do I set focus on a particular treenode at run
time? If you need to know what I'm try to do please read on ...

I have a treeview to represent a Country/Product scenario (i.e. a country,
as parent node, produce 1 to many product, as childnode). When the user
click on one of the node a group of textbox/combo box etc will be
populated and if btnSave is clicked data will then be updated and the
treeview will be reloaded.

I'm trying to "remember" the selected node , it could be parent or child
node, and after the treeview is refreshed I want to set focus to the that
node again. However I can't find the focus method for a node.....anyone
know how?

Thx!

Kay

Nov 23 '05 #4

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

Similar topics

0
436
by: hzgt9b | last post by:
Using visual studio .NET 2003, VB: I'm experiencing an issue with a TreeView object when it gets focus - the first root node in the tree always gets selected when the control gets focus - even if another node has been clicked on... Here's my scenario: In my application, I have a couple of trees fully expanded as it starts up. The user then selects a node from somewhere in the tree structure. Unfortuantely, every time I've tested, the...
3
1822
by: Dave | last post by:
I use the treeview to open a new form but the treeview reclaims focus after MouseUp. Any solutions to this problem?
1
15545
by: Rasmus | last post by:
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") {
6
6724
by: Tim | last post by:
Hi I have a form with a treeview on it. When I select a particular node it adds/shows a tab on the form. The treeview node remains selected as it should. The user can close the tab or remove the focus to another tab. Clicking on the same already selected node should add/show the tab, however the after select event does not fire as the node is already selected. I trapped the click event of the treeview but that is not node specific. In...
1
6362
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...
2
9789
by: Claus | last post by:
Hello, I have a long treeview with scrollbars. When I scroll down and press a treeview node, then the Load event fires and navigate in an iframe to another page. The problem is, that afterwards the treeview is collapsed and the node isn't selected. Expanding and selecting the node via code in the load event works, but how do I achieve, that the treeview scrolls down to the selected node? Thanks for any help Claus
3
21858
by: Michael_Burgess | last post by:
Hi there, I've looked around the different groups and still can't figure this out without resorting to scrappy code............ I want to programtically select and highlight a TreeView node, such that it looks the same as if a user has clicked it. I'm aware about the SelectedNode property, but this just seems to expand the TreeView to show the node in question, but not highlight
2
13428
by: bg_ie | last post by:
Hi, I have a treeview where the user selects a node before editing it. The problem is that when the user clicks on the text box to edit the node, the treeview loses its focus and the node is no longer highlighted. To fix this I do something like - void treeView_AfterSelect(object sender, EventArgs e) { selectedNode.BackColor = Color.White;
18
15371
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and click to make multiple selections. Then when I simply click one item, all previous selections are gone. Thanks in advance.
0
8736
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
8649
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
9229
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
7824
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
5904
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
4410
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
4662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3102
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
2398
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.