Previous Page
Next Page

Events in Visual Studio 2005 Tools for Office

Several events are found in Visual Studio 2005 Tools for Office objects that are not found when using the Excel PIA alone. Table 4-2 lists these events. Almost all of these are events from the Excel PIA that are re-raised on different objects. For example, in the Excel PIA, there is no BeforeDoubleClick event on a Range objectin fact, there are no events on the Range object at all. In VSTO, the two objects that VSTO defines that represent a Range (NamedRange and XMLMappedRange) have a BeforeDoubleClick event. VSTO adds the BeforeDoubleClick event to these objects and raises the event whenever the Worksheet.BeforeDoubleClick event is raised and passed a Range object that matches the given NamedRange or XMLMappedRange object.

Table 4-2. Events That Are Added in VSTO

Events

Re-Raised From

NamedRange Object (Aggregates Range)

BeforeDoubleClick

Worksheet.BeforeDoubleClick

BeforeRightClick

Worksheet.BeforeRightClick

Change

Worksheet.Change

SelectionChange

Worksheet.SelectionChange

Selected

Worksheet.SelectionChange

Deselected

Worksheet.SelectionChange


XmlMappedRange Object (Aggregates Range)

BeforeDoubleClick

Worksheet.BeforeDoubleClick

BeforeRightClick

Worksheet.BeforeRightClick

Change

Worksheet.Change

SelectionChange

Worksheet.SelectionChange

Selected

Worksheet.SelectionChange

Deselected

Worksheet.SelectionChange


Workbook

New

Application.NewWorkbook

Startup

New event

Shutdown

New event


ChartSheet (Aggregates Chart)

Startup

New event

Shutdown

New event


Worksheet

Startup

New event

Shutdown

New event


ListObject

BeforeAddDataBoundRow

New event

BeforeDoubleClick

Worksheet.BeforeDoubleClick

BeforeRightClick

Worksheet.BeforeRightClick

Change

Worksheet.Change

DataBindingFailure

New event

DataMemberChanged

New event

DataSourceChanged

New event

Deselected

Worksheet.SelectionChange

ErrorAddDataBoundRow

New event

OriginalDataRestored

New event

Selected

Worksheet.SelectionChange

SelectedIndexChanged

New event

SelectionChange

Worksheet.SelectionChange


Another case where VSTO changes events is in the naming of the Activate event and the Select event on the Worksheet object. Both of these event names conflict with method names on Worksheet. To avoid this conflict, VSTO renames these events to ActivateEvent and SelectEvent.

There are also some new events such as the Startup and Shutdown events raised on VSTO project host items such as Workbook, Worksheet, and ChartSheet. ListObject also has several new events that are raised when ListObject is data bound.


Previous Page
Next Page