DoDefaultAction Method

AccessibleObject.DoDefaultAction Method

Performs the default action associated with this accessible object.

[Visual Basic]
Public Overridable Sub DoDefaultAction()
public virtual void DoDefaultAction();
public: virtual void DoDefaultAction();
public function DoDefaultAction();


Exception Type Condition
COMException The default action for the control cannot be performed.


Clients can retrieve the object's default action by inspecting an object's DefaultAction property. A client can use automation (if supported) instead of DoDefaultAction to perform an object's default action. However, DoDefaultAction provides an easy way to perform an object's most commonly used action.

Notes to Inheritors:  The default action performed by system-provided user interface elements depends on the keyboard state. That is, if a modifier key such as SHIFT, ALT, or CTRL is down (either by a user action or programmatically) when DoDefaultAction is called, the default action might not be the same as when those keys are not down. Not all objects have a default action.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

AccessibleObject Class | AccessibleObject Members | System.Windows.Forms Namespace

© 2016 Microsoft