Solved

Disable the textbox when a certain treeview node is selected

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

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 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

18 Experts available now in Live!

Get 1:1 Help Now