?
Solved

Explenation needed of a methode

Posted on 2011-03-17
3
Medium Priority
?
207 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 1800 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 200 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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:…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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