Solved

Explenation needed of a methode

Posted on 2011-03-17
3
202 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 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