Solved

Disable the textbox when a certain treeview node is selected

Posted on 2011-03-19
2
424 Views
Last Modified: 2013-12-17
hi,

I have a treeview on the left and a textbox on the right devided by a splitter.
What treeview-event should i use when I want to disable the textbox
when a user clicks on a treeview node that has a imageindex 3.

I would say: the afterselect-event but I have allready code there to show text
in the textbox when a treeview node is selected.

        private void tvNotes_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DataRow row = e.Node.Tag as DataRow;
            txtbNotes.Text = row["Data"].ToString();
        }


Who can help me?

Greetings, peterkiers
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
2 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 500 total points
ID: 35171867
Modify your event handler to the following:

private void tvNotes_AfterSelect(object sender, TreeViewEventArgs e)
{
  DataRow row = e.Node.Tag as DataRow;
  txtbNotes.Text = row["Data"].ToString();
  if (e.Node.ImageIndex == 3)
  {
    txtbNotes.Enabled = false;
  }
  else
  {
    txtbNotes.Enabled = true;
  }
}
0
 
LVL 1

Author Comment

by:peterkiers
ID: 35171877
Thanx it works.

Peter
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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