Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

In window based application, I have treeview on form1.treeview filled from the database.
My problem is that when I delete a treenode from form2 on button click event at that time database update but treeview not refresh.
C#
form1 f= new form1();
            
f.treeView1.Nodes.Clear();    
f.treeView1.BeginUpdate();                
f.form1_Load(sender, e);           
f.treeView1.EndUpdate();      
f.treeView1.Refresh();  

in f.form1_Load(sender, e); I call the populatesnodes method which filled the treeview.
Posted
Updated 2-Oct-10 4:13am
v2

Hi Amitthakkar,

Just call your populatesNodes method in form constructor.After deletion again call the form constructor means you can get the latest treeview.

Try this one i think its work fine.

Cheers :)
 
Share this answer
 
after updating the database you should call the populatesnodes method once again so that fresh data is loaded into the treeview.
 
Share this answer
 

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