Solved

Explenation needed about a methode

Posted on 2011-03-17
2
195 Views
Last Modified: 2013-12-17
Hi,

Can someone explain the following lines for me:

        private void tvNotes_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
         try
         {
             if (e.Label.Trim().Length < 1) { e.CancelEdit = true; }  
             EditNode(tvNotes.SelectedNode,e.Label);                  <=====
             tvNotes.SelectedNode.EndEdit(false);          <=========
             tvNotes.LabelEdit = false;   <========
         }
         catch (Exception err) { MessageBox.Show(err.Message); }
         }


Grtz, Peter Kiers
0
Comment
Question by:peterkiers
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 35159342
            EditNode(tvNotes.SelectedNode,e.Label);                  <=====

Calls a method named EditNode on the current class, passing the selected tree node and the new label string.

             tvNotes.SelectedNode.EndEdit(false);          <=========

Saves the changes to the selected tree node, and updates the screen with the change.

             tvNotes.LabelEdit = false;   <========

Indicates that the TreeView node labels cannot be edited.


I hope this helps.
0
 
LVL 11

Expert Comment

by:wrmichael
ID: 35159346
 private void tvNotes_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
         try
         {
             if (e.Label.Trim().Length < 1) {

              //this cancels the labeledit if the length is of the label is less than 1 or blank
              e.CancelEdit = true;


 }  
             //this looks like a function.  do you have the code for it?
             EditNode(tvNotes.SelectedNode,e.Label);                  <=====
            //not sure
             tvNotes.SelectedNode.EndEdit(false);          <=========
//stop people from editing            
tvNotes.LabelEdit = false;   <========
         }
         catch (Exception err) {
//shows error
MessageBox.Show(err.Message); }
         }
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

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…
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!
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

19 Experts available now in Live!

Get 1:1 Help Now