Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi Friends,

Code:

C#
private void treeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
   StatusBar.text = "Loading Files";
   //ArrayList files1,ListView ListView1
   filllist(files1, ListView1);
   StatusBar.text = "List contains X Items";
}


After clicking a node in treeview control application waits to load the items. But in case there is another click on the control, and loading node will go invisible mode.

My question is how to temporarily disable treeview control untill the first click job is over? I tried Treeview.enable = false; and SuspendLayout property. But no use :(
Hope my question make sense.
Posted
Updated 1-Jun-11 1:41am
v3

0) Use a thread for the "loading" stuff that happens

1) In the "clicked" event handler for the list control, see if the loading thread is still running. If it is, don't do anything.

2) Or, while the thread is running, disable the list control (I'd probably do it this way).
 
Share this answer
 
Comments
2000 P 1-Jun-11 7:56am    
Thanks John for the soln.
Hi,

Try this code
treeView.Enabled=false;
treeView.Refresh();
fillist(files1, ListView1);
treeView.Enabled=true;


Regards
AR
 
Share this answer
 
Comments
2000 P 1-Jun-11 7:55am    
Thanks Ankit.
You can try this

private void treeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
treeView.Enabled=false;

StatusBar.text = "Loading Files";
//ArrayList files1,ListView ListView1
filllist(files1, ListView1);
StatusBar.text = "List contains X Items";
treeView.Enabled=true;

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900