473,472 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

treeview control continous...

I manage to fill treeview control with data and I would like to search
through that data.

In child I have names of films, and when I click on one of them I would like
to show it's information in grid.
How?

Hrcko
Nov 16 '05 #1
3 1346
In answer to your first question, you have to iterate your TreeNodes
recursively, such as

private TreeNode SearchNodes(string nodeName)
{
foreach(TreeNode node in myTreeView.Nodes)
{
if (string.Compare(nodeName, nodeText, true) == 0)
{
return node;
}
TreeNode foundNode = null;
foreach(TreeNode childNode in node.Nodes)
{
foundNode = SearchNodes(nodeName);
if (foundNode != null)
{
return foundNode;
}
}
}
return null;
}
As for your second question, just handle the AfterSelect event of your
TreeView and then use the SelectedNode property to determine which node was
selected.

HTH,

DalePres
MCAD, MCDBA, MCSE
"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d1**********@ls219.htnet.hr...
I manage to fill treeview control with data and I would like to search
through that data.

In child I have names of films, and when I click on one of them I would
like to show it's information in grid.
How?

Hrcko

Nov 16 '05 #2
What is nodeText in this function?

Hrcko
"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:eW**************@TK2MSFTNGP10.phx.gbl...
In answer to your first question, you have to iterate your TreeNodes
recursively, such as

private TreeNode SearchNodes(string nodeName)
{
foreach(TreeNode node in myTreeView.Nodes)
{
if (string.Compare(nodeName, nodeText, true) == 0)
{
return node;
}
TreeNode foundNode = null;
foreach(TreeNode childNode in node.Nodes)
{
foundNode = SearchNodes(nodeName);
if (foundNode != null)
{
return foundNode;
}
}
}
return null;
}
As for your second question, just handle the AfterSelect event of your
TreeView and then use the SelectedNode property to determine which node
was selected.

HTH,

DalePres
MCAD, MCDBA, MCSE
"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d1**********@ls219.htnet.hr...
I manage to fill treeview control with data and I would like to search
through that data.

In child I have names of films, and when I click on one of them I would
like to show it's information in grid.
How?

Hrcko


Nov 16 '05 #3
A typo. It should read: node.Text

DalePres

"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d1*********@ls219.htnet.hr...
What is nodeText in this function?

Hrcko
"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:eW**************@TK2MSFTNGP10.phx.gbl...
In answer to your first question, you have to iterate your TreeNodes
recursively, such as

private TreeNode SearchNodes(string nodeName)
{
foreach(TreeNode node in myTreeView.Nodes)
{
if (string.Compare(nodeName, nodeText, true) == 0)
{
return node;
}
TreeNode foundNode = null;
foreach(TreeNode childNode in node.Nodes)
{
foundNode = SearchNodes(nodeName);
if (foundNode != null)
{
return foundNode;
}
}
}
return null;
}
As for your second question, just handle the AfterSelect event of your
TreeView and then use the SelectedNode property to determine which node
was selected.

HTH,

DalePres
MCAD, MCDBA, MCSE
"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d1**********@ls219.htnet.hr...
I manage to fill treeview control with data and I would like to search
through that data.

In child I have names of films, and when I click on one of them I would
like to show it's information in grid.
How?

Hrcko



Nov 16 '05 #4

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

Similar topics

0
by: Thorsten Bast | last post by:
Hi, I'm sorry if this problem should have been sufficiently discussed here, but so far I could not find a satisfactory answer. I'm managing rental contracts with an access database and want to...
5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
8
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
4
by: Ben Coats | last post by:
Hey, I'm trying to find code for an Explorer-style Directory ComboBox. (You know, it display "Desktop", "My Computer", all drives, etc., but it has a treeview control inside the combobox so that...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: musosdev | last post by:
Hi guys I was using the Microsoft.Web.UI.WebControls extra namespace in my application to provide me with a TreeView control. I was using specifically ..GetNodeFromIndex(), SelectedNodeIndex and...
0
by: noneya22 | last post by:
I want to use a TreeView control as a one-level, vertical navigation menu. I'm using this control currently with a SiteMapDataSource and .sitemap file. I've written code that associates an image...
0
by: jiing | last post by:
Hi all, I want to use sting(the same as Node.Text) to judge if a node exists in TreeView. I've tried several ways, but seems all failed. could anybody help me? Thanks in advance. //My...
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
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...
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...
1
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...
0
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,...
0
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...
0
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...
0
muto222
php
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.