Solved

Disable the textbox when a certain treeview node is selected

Posted on 2011-03-19
2
423 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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Returning a value from a class function to a partial view in MVC5 7 46
linq, c# 8 32
MYSQL responding very slow 3 49
VS2010 Build fails to install 14 78
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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