Solved

c# .net treeview... double click expanding vs executing further processing

Posted on 2006-07-21
2
849 Views
Last Modified: 2012-06-21
Hi Experts!!

I have a treeview in a winforms c#.net app that I want to on double click expand to the child nodes if they exist, if they don't, it considers it the lowest level and calls a process to generate a report.

Right now I have it calling the process successfully but if it is not the lowest level node and they double click, it will call the process as well and that's not good.  So I need to add logic to identify if the selected node has children and if so, just expand to the next level. If not, call the further processing.

I'm not sure how to do that. Can you help me?
0
Comment
Question by:babybird
2 Comments
 
LVL 10

Expert Comment

by:NetworkArchitek
ID: 17158338
So in your double click event, assuming the TreeEventArgs argument is called e, then do

if(e.Node.Nodes.Count == 0)
           runProcess();
0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 250 total points
ID: 17164593
DoubleClick event does NOT contain TreeEventArgs argument ...

        private void treeView1_DoubleClick(object sender, EventArgs e)
        {

            TreeView tv = sender as TreeView;
            TreeNode selected = tv.SelectedNode;
            if (selected == null)
                return;

            if (selected.Nodes.Count == 0)
            {
                runProcess();
            }
            else
            {
                selected.Expand();
            }
        }
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question