AfterCheck event for TreeView control

G

Guest

Hi,

I registered event handler to catch the AfterCheck event...

myTreeView.AfterCheck += new TreeViewEventHandler(myTreeView_....);

It works fine, however, if I set the checkbox as true or false
programatically(I mean..in the code, somethinglike node.Checked = true...),
aftercheck event
wasn't fired. Of course, if I checked the checkbox by mouse or keyboard, the
event was fired. However, again, programatically set checkbox didn't invoke
the aftercheck event.

Am I missing something?
Any suggesion would be appreciated.

Thanks.

................................................TJ
 
C

Carlos J. Quintero [.NET MVP]

I am unable to reproduce your problem. Using C# 2003 with a form, a treeview
with some nodes and a button, this code works fine for me:

private void treeView1_AfterCheck(object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
MessageBox.Show(e.Node.Text + " changed the state");
}

private void button1_Click(object sender, System.EventArgs e)
{
treeView1.Nodes[0].Checked = !treeView1.Nodes[0].Checked;
}

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top