Solved

Explenation needed of a methode

Posted on 2011-03-17
3
206 Views
Last Modified: 2013-12-17
Hi,

Can someone translate these lines for me
I am trying to understand the code

Peter
private void tvSampleRightClickEdit(object sender, System.EventArgs e)
        {
            Hourglass(true);
            try
            {
                TreeNode node = tvNotes.SelectedNode;  <=============
                if (node == null) { return; }  <==================
                if (node == tvNotes.Nodes[0]) { return; }   <=============
                node.TreeView.LabelEdit = true;
                node.BeginEdit();    <===============================
            }
            catch (Exception err) { MessageBox.Show(err.Message); }
            finally { Hourglass(false); }
        }

Open in new window

0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 450 total points
ID: 35158967
               TreeNode node = tvNotes.SelectedNode;  <=============

Set node to the tree node selected on the screen.

                if (node == null) { return; }  <==================

If no node is selected, return.

                if (node == tvNotes.Nodes[0]) { return; }   <=============

If the selected node is the first node on the tree, return.

                node.BeginEdit();    <===============================

Begin editing the node, that is changes to the node won't be reflected on the screen until EndEdit is executed.

I hope this helps.
0
 
LVL 14

Assisted Solution

by:robasta
robasta earned 50 total points
ID: 35159012
line 6: Create a new object 'node' of type 'TreeNode', assign it the value of the 'SelectedNode' in the treeview with id 'tvNotes'
line 7: If the value of the object 'node' is null (i.e. if node is 'empty') then exit this current method
line 8: If the value of the object 'node' is equal to that of the first node in the treeview 'tvNotes', then exit this method
line 10: Call the BeginEdit() method  of the node object.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 35159025
thnx. p
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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