Accessing a class

Hi,
I have this methode on my main form:

        private void MainForm_Load(object sender, EventArgs e)
        {
            ClearFormFields();
            xmlDocument = new System.Xml.XmlDataDocument();
            xmlDocument.Load(strXmlDocument);
            ????????. XPathFilter = "attribute::id";  <=======================

How to access the methode XPathFilter in another class from the main form.

The class looks like this:

namespace DemoCatalogue
{
    class ProdCatalogue
    {
        public string XPathFilter
        {
            get
            {
                return xpath_filter;
            }
            set
            {
                xpath_filter = value;
            }
        }

    }
}

Who can ehelp me?

Peter
LVL 1
peterkiersAsked:
Who is Participating?
 
p_davisConnect With a Mentor Commented:
to do it that way the property would have to be static.

the way it is now you need an instance of that class

ProdCatalogue pc = new ProdCatalogue()

pc.XPathFilter = "attribute::id";  <========
0
 
peterkiersAuthor Commented:
Are there other ways also?
P.
0
 
p_davisCommented:
well, in short, yes with delegates but it is somewhat more complicated
0
 
peterkiersAuthor Commented:
It works.

Peter
0
 
p_davisCommented:
cool
0
All Courses

From novice to tech pro — start learning today.