Properties in Office Projects

There are several important properties that are available to Office projects in Visual Studio. These properties can be accessed in the Properties window.

Applies to: The information in this topic applies to document-level projects and application-level projects for Microsoft Office 2013 and Microsoft Office 2010. For more information, see Features Available by Office Application and Project Type.

Namespace for Host Item

Use the Namespace for Host Item property to change the namespace for host item classes (for example, the ThisAddIn, ThisWorkbook, or ThisDocument classes) in Visual C# projects. This property appears in the Properties window when you select the document node in a document-level project (such as ExcelWorkbook1.xlsx or WordDocument1.docx) or the application node in an application-level project (such as Excel or Word) in Solution Explorer.

When you create a Visual C# Office project, host items are given a namespace based on the name of the project. It is recommended that you use the Namespace for Host Item property to change the namespace rather than edit the code files directly. When you use this property, the namespace is changed in the generated (hidden) code files, as well as in the visible code files.

CacheInDocument

The CacheInDocument property appears in the Properties window for document-level projects when you select an instance of a DataSet in the Visual Studio designer. Only public members can be cached; ensure that the Modifiers property is set to Public if you want to cache a DataSet.

This property takes a Boolean value:

  • Select true to cache the dataset in the document.

  • Select false if you do not want the dataset to be cached in the document.

For more information about caching data, see Cached Data in Document-Level Customizations.

Value2

The Value2 property is only available for Excel workbook or template projects. It appears under the Databindings property node in the Properties window when you select a NamedRange control on the worksheet designer.

Use the Value2 property in the Properties window to bind the Value2 property of the NamedRange to a field in your data source.

See Also

Concepts

Events in Office Projects

Other Resources

Designing and Creating Office Solutions

Office Project Templates Overview