Hi, i have a windows form application and the main thing in there is a treeview, and i am adding nodes to the treeview. so i have another class file that will consist of the algorithm of how those things work for the treeview. the problem is i can't call the function from the treeview class unless i make the function static but the member of windows form are private and the static function cannot access non static member. can anybody help me or give me advice of solving this problem? the code is something similar to this. They are both in the same namespace.
public partial class TreeViewx1 : UserControl
{
public void UpdateTreeView()
{
TreeView1.Nodes["test"].Nodes.Add(new TreeNode("test11"));
}
}
class class22
{
//other algorithm
UpdateTreeView();
}
the only thing i can call the UpdateTreeView() is to make it static. then it will be something like this TreeViewx1.UpdateTreeView();
but the TreeView1 in the form is private and non static. how can i solve this? thanks.