• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Accessing a component on a main form from a class.

Hi,

How can I access the treeview on the main form
with a methode from a class:

        public void Load(System.Xml.XmlDocument document)
        {
            xml_document = document;
            ?????.Nodes.Clear();  <==================================
            }
        }

P.
0
peterkiers
Asked:
peterkiers
1 Solution
 
Imran Javed ZiaCommented:
Hi,
There are two ways

change the method as and make TreeView public
public void Load(System.Xml.XmlDocument document, TreeView tv)
        {
            xml_document = document;
            tv.Nodes.Clear();  <==================================
            }
        }


alternatively add public property in Form to return the TreeView and access that propert with form object in this method

Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now