By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,706 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,706 IT Pros & Developers. It's quick & easy.

TreeView Double Click Event Strange Problem

P: n/a
I have a tree view which has Check Box's beside each node.
In the BeforeCheck event Handler I have canceled the event to
prevent the user from Checking/ Un-checking the box:
private void treeView3_BeforeCheck(object sender, TreeViewCancelEventArgs e)
e.Cancel = true;
I am trying to now set up the DoubleClick event but the first time
the user double clicks the event is not called. For example the first
time clicked it will expand/Collapse the node but the event will not be
called. Every time after that it works correctly.
All I am doing currently is doing a Console.WriteLine();
private void treeView3_DoubleClick(object sender, EventArgs e)
Console.WriteLine("Double Click Invoked");
A co-worker also has a similar problem with right clicking to bring up
a context menu. The first time it does not work then every time after
that it works as expected.

The following is under the InitializeComponent();

this.treeView3.DoubleClick += new

this.treeView3.BeforeCheck += new
System.Windows.Forms.TreeViewCancelEventHandler(th is.treeView3_BeforeCheck);

This Problem occurs every time the tree view is repopulated, Which is
simply done by clicking a button.

Any ideas would is appreciated.
Sep 16 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.