Properties Window

Both Visual Studio and the VBE have a Properties window. This window, which displays the properties of the currently selected item in your project, enables you to modify the properties during application design. However, some of the property values do not change until the project is actually running. For example, if you set the Visible property of a Win-

Figure 2.16. Add New Item dialog box

dows Form control to False, the control becomes invisible only when the application is running; but if you set the control's Text property, the resulting text can be viewed immediately because it is displayed at design time as well as at run time. Also, some properties cannot be changed at design time, and they are displayed as grayed-out entries. These properties are either informational and cannot be set (read-only) or can be changed only at run time.

When you create a VSTO solution, such as a workbook project, you'll notice that the Properties window displays and makes available the properties of the workbook or any of the worksheets that were created. You get the same behavior in the Excel VBE, but there are some differences. First, you are viewing the properties of two different objects. In the VBE, you are viewing properties of an Excel Worksheet object, and in VSTO, you are viewing properties of a Microsoft.Office.Tools.Excel.Worksheet. Because a VSTO worksheet has additional functionality, you'll see additional properties on a VSTO worksheet that are not found on a native worksheet object. For example, notice that there is a DataBindings property, because you can bind data directly to a VSTO worksheet.

If you click the Events button (the lightening bolt) in the Properties window in Visual Studio, it displays all the events that are available for a VSTO worksheet.

Another difference is that many of the properties available in the VBE are not equally available in Visual Studio (and vice versa). One reason is that many of the properties that are available in the VBE are filtered in Visual Studio. Also, Visual Studio displays some read-only properties that are not available in the VBE. Figure 2.17 shows the Properties window for Sheet1 in the VBE and in Visual Studio.

Properties - Sheet 1

Sheetl Worksheet

Alphabetic | Categorized

(Name)

Sheetl

0 ¬°splayPageBreaks F sise

loisplayRightToLefl: False

EnableAutoFilter

False

EnableCalculation

True

Enableöutlining

False

EnablePivotTable

False

EnableSelection

0 - xINoRestrictions

Name

Sheetl

IScrollArea 1_

Standard Width

6.43

Visible

-1 - xlSheet Visible

Properties

5heet 1 Microsoft .of fice.Tools. Excel, worksheet

0 (DataSindings)

(Name) Sheet 1

ConsolidationFunction xlSurri

DisplayRightToLeft False

FilterMode False

Index 1

ProtectContents False

ProtectDrawingObjects False

ProtectionMode False

ProtectScenarros False

5tandardHeight 12,75

StandardWidth 8.43 Tag

TransitionExpEval False

TransltionFormEntry False

Figure 2.17. Properties window for Sheetl in the VBE (left) and in Visual Studio (right)

0 0

Post a comment