Problem with treeview check node event

  • Thread starter Thread starter Ingman
  • Start date Start date
I

Ingman

Hi all,

Im using a treeview with checkboxes. When the user checks a node, if this
node had children, theese should be checked aswll. Im using the following
code under the nodecheck event:

Dim pNode As Node
Dim cNode As Node
Set pNode = Node

If pNode.Children > 0 Then
Set cNode = pNode.Child
Do
cNode.Checked = pNode.Checked
If cNode = cNode.LastSibling Then
Exit Do
Else
Set cNode = cNode.Next
End If
Loop
End If
Set pNode = Nothing
Set cNode = Nothing

And at first it looks just fine, however if the user checks/unchecks the
parent nodes really quickly, sometimes the children does not get checked. Its
hard to replicate but before i go any further with this case I just wanted to
check with you guys if you know anything about this behaviour?

Any ideas would be greatly appreciated :)

Best Regards,

Ingman
 
Hi,
try to declare a new variable, set it value to pNode.Checked, and then use
it to set cNode.Checked. Perhaps this is a reason. Anyway - I also use
similar code, and did not experience such problems

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.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

Back
Top