Solved

Explenation needed of a methode

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c#, case, if 4 34
c#  FTP ftpwebrequest URI invalid 6 38
Error in Visual Project 10 41
How to get the range for the percentage from user input. 4 17
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:…
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!
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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