02-09-2022
01:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-09-2022
01:59 AM
Hello @Anonymous
Error means exactly what is written in error code
When you type:
Document doc = this.ActiveUIDocument.Document; you mean, that you want accessing to property "ActiveUIDocument" of "Class1"
However, I can't see property "ActiveUIDocument" in your code snippet. Also "Class1" doesn't inherit from any class, that might contain this property. That's why compiler throws an error.
To avoid this error, modify your code like this:
........
public class Class1
{
public UIDocument ActiveUIDocument { get; private set; }//define property with private set signature - it means you can't asign property value outside of your class
public Class1(UIDocument uIDocument)//define constructor
{
ActiveUIDocument = uIDocument;//asign value to your property
}
.........//the rest of the code snippet remains unchanged
}