This document is archived and information here might be outdated.  Recommended version.


IToolbarControl2.Update Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControl2 Interface > IToolbarControl2.Update Method
ArcGIS Developer Help

IToolbarControl2.Update Method

Updates the enabled state of the specified item or all items if an index of -1 is specified. Specify fullUpdate to update the group, group spacing, style and bitmap properties.

[Visual Basic .NET]
Public Sub Update ( _
    [ByVal index As Integer], _
    [ByVal fullUpdate As Boolean] _
)
[C#]
public void Update (
    int index,
    bool fullUpdate
);
[C++]
HRESULT Update(
  long index,
  VARIANT_BOOL fullUpdate
);
[C++]
Parameters
index [in, optional, defaultvalue()]

index is a parameter of type long fullUpdate [in, optional, defaultvalue()]
fullUpdate is a parameter of type bool

Product Availability

Available with ArcGIS Engine.

Description

The primary job of the Update method is to ensure that each item on the ToolbarControl is synchronised with the ICommand properties of the IToolbarItem::Command.

By default the index argument is -1, and each item on the ToolbarControl is updated. To update a specific item, specifiy its index. The item at the beginning of the collection to the left of the ToolbarControl has an index of 0.

By default the fullUpdate argument is false, and each item is updated to reflect its ICommand::Enabled, ICommand::Caption and ICommand::Checked properties. Pass true to Update to additionally update the following properties: ICommand::Bitmap, IToolbarItem::Style, IToolbarItem::Group and IToolbarItem::GroupSpacing properties.

By default the Update method is called automatically on a regular interval specified by the UpdateInterval to ensure that the ToolbarControl item's reflect the current application state. This updates all items, but with a fullUpdate argument set to false.

Errors Returned

1023 800a03ff: The specified index is out of range

Remarks

The Update method checks each commands ICommandPool::Created property. If the command has not been created the ICommandPoolEdit::Hook property is passed into the ICommand::OnCreate method. The hook it typically the ToolbarControl.

[C#]

When using the Update method to update each item on the ToolbarControl pass -1 as the index argument. Failing to do will result in only the item at index 0 being updated. 

axToolbarControl1.Update(-1, false)
[Visual Basic .NET]

When using the Update method to update each item on the ToolbarControl pass -1 as the index argument. Failing to do will result in only the item at index 0 being updated. 

AxToolbarControl1.Update(-1, False)

See Also

IToolbarControl2 Interface