GetButtonIdForCommandButton() public static method

Gets the buttonId for a command button.
When creating the config options for the dialog and specifying command buttons, typically you pass in an array of button label strings. The index specifies which button to get an id for. If you passed in Save, Don't Save, and Cancel, then index 2 specifies the Cancel button.
public static GetButtonIdForCommandButton ( int index ) : int
index int The zero-based index into the array of command buttons.
return int
 /// <summary>
 /// Sets the elevation required state of a command link button, adding a shield icon.
 /// </summary>
 /// <param name="index">The zero-based index of the button to set.</param>
 /// <param name="elevationRequired"><c>true</c> to show a shield icon; <c>false</c> to remove</param>
 /// <remarks>
 /// Note that this is purely for visual effect. You will still need to perform
 /// the necessary code to trigger a UAC prompt for the user.
 /// </remarks>
 public void SetCommandButtonElevationRequiredState(int index, bool elevationRequired)
 {
     SetButtonElevationRequiredState(TaskDialog.GetButtonIdForCommandButton(index), elevationRequired);
 }
 /// <summary>
 /// Simulate the action of a command link button click in the TaskDialog.
 /// </summary>
 /// <param name="index">The zero-based index into the button set.</param>
 /// <returns>
 /// If the function succeeds the return value is true.
 /// </returns>
 public bool ClickCommandButton(int index)
 {
     return(ClickButton(TaskDialog.GetButtonIdForCommandButton(index)));
 }
 /// <summary>
 /// Sets the state of a command link button to enabled or disabled.
 /// </summary>
 /// <param name="index">The zero-based index of the button to set.</param>
 /// <param name="enabled"><c>true</c> to enable the button; <c>false</c> to disable</param>
 public void SetCommandButtonEnabledState(int index, bool enabled)
 {
     SetButtonEnabledState(TaskDialog.GetButtonIdForCommandButton(index), enabled);
 }