Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable the textbox when a certain treeview node is selected

Posted on 2011-03-19
2
Medium Priority
?
428 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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