add node triggered by event
help me, please.
Im trying to add node into a tree view.This method is raised by an event.
The method is succesfully executed, and nodes.add() is executed but the node doesn't appear in the tree view .What is the problem.Is this some bug
Oh btw , here is my code :
the class that have the event
public delegate void FillIt(string nodeText);
public class DelegatedClass
{
public event FillIt GoFilling;
public DelegatedClass()
{
}
public void Notifikasi(string tes)
{
foreach (FillIt usil in GoFilling.GetInvocationList())
{
usil.BeginInvoke(tes ,null,null);
}
}
}
the form class :
1 public class Form1 : System.Windows.Forms.Form
2 {
3 #region member variable
4 private System.Windows.Forms.Button uiAppendNodeButton;
5 private System.Windows.Forms.TextBox uiNodetextBox;
6 private System.ComponentModel.Container components = null;
7 private System.Windows.Forms.TreeView controlledtreeView;
8 private System.Windows.Forms.Button button1;
9 private System.Windows.Forms.Button button2;
10
11 protected TreeController _testedController ;
12 protected DelegatedClass _delegasi;
13
14 #endregion
15
16 public Form1()
17 {
18 InitializeComponent();
19 _delegasi = new DelegatedClass();
20 _delegasi.GoFilling+=new FillIt(Tes );
21 _testedController = new TreeController(controlledtreeView.Nodes);
22 }
23
24
25 private void button2_Click(object sender, System.EventArgs e)
26 {
27 _delegasi.Notifikasi(uiNodetextBox.Text);
28 }
29
30
31 private void Tes(string pesan)
32 {
33
34 controlledtreeView.Nodes.Add(pesan);
35 controlledtreeView.Update();
36 }
37 }
if button2 cliecked it succesffuly trigger method tes , but the node that added doesn't appear in the tree view