Solved

Explenation needed of a methode

Posted on 2011-03-17
3
200 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
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 450 total points
Comment Utility
               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
Comment Utility
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
Comment Utility
thnx. p
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now