Home » C# ProgrammingRSS

Check doesn't work properly in using treeview with checkbox

I am using treeview in my form in a windows application

There are multiple treeview in the form and each next treeview binds depending on the checked content in previous treeview.

For Ex-State treeview contains the list of states from the database and when we select the state then its correponding cities gets binded on next city treeview. And this action performs on AfterCheck event of treeview.

But the problem is,some times a checked node is considered unchecked and if i uncheck a checked node,it wont consider that in unchecked status. and its not like this issue occurs evreytime but happens once in 3-4 check/uncheck operation.

Is there any permanent solution to get rid of this problem?

Thanks

 

 

4 Answers Found

 

Answer 1

I am using treeview  in my form  in a windows  application

There are multiple  treeview in the form and each next treeview binds depending  on the checked  content in previous  treeview.

For Ex-State treeview contains the list  of states  from the database  and when we select  the state  then its correponding cities  gets binded  on next city  treeview. And this action  performs on AfterCheck event  of treeview.

But the problem  is,some times  a checked node  is considered  unchecked and if i uncheck  a checked node,it wont consider that in unchecked  status. and its not like this issue  occurs evreytime but happens once in 3-4 check/uncheck operation.

Is there any permanent  solution to get rid  of this problem?

Thanks

 

http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.checkboxes.aspx
 

Answer 2

Hi,

You might need to show use the code relate to the problem  you described, it's not easy to say what's going on on your side otherwise.

Also here is a checkbox treeview  example are using  two functions to process a state  change and update the nodes above and below the node  which changed state.

http://www.codeguru.com/cpp/controls/treeview/misc-advanced/article.php/c3983

Have a look on it.

Thanks

Binze

 

Answer 3

I tried the link given by Malange though its an example for parent child nodes.

I wrote all three cases on treeview  AfterCheck and Click event.

(1) TreeView.BeginUpdate();
    
  TreeView.EndUpdate();


(2) TreeView.Update();
(3) TreeView.Refresh();
But still the same problem, am i on the right way?

 

 

Answer 4

Hi Bin-ze Zhao

 

The link you gave doesn't have any code help though it has a vb project but it doesn't open on my PC!

 

Thanks

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter