Click to Rate and Give Feedback
MSDN
MSDN Library
Windows PowerShell
 PSHostUserInterface.PromptForChoice...
Collapse All/Expand All Collapse All
PSHostUserInterface.PromptForChoice Method
Provides a set of choices that enable the user to choose a single option, a choice, from a set of options.


Namespace: System.Management.Automation.Host
Assembly: System.Management.Automation (in system.management.automation.dll)
Dim instance As PSHostUserInterface
Dim caption As String
Dim message As String
Dim choices As Collection(Of ChoiceDescription)
Dim defaultChoice As Integer
Dim returnValue As Integer

returnValue = instance.PromptForChoice(caption, message, choices, defaultChoice)
Visual Basic
Public MustOverride Function PromptForChoice ( _
    caption As String, _
    message As String, _
    choices As Collection(Of ChoiceDescription), _
    defaultChoice As Integer _
) As Integer
C#
public abstract int PromptForChoice (
    string caption,
    string message,
    Collection<ChoiceDescription> choices,
    int defaultChoice
)
C++
public:
virtual int PromptForChoice (
    String^ caption, 
    String^ message, 
    Collection<ChoiceDescription^>^ choices, 
    int defaultChoice
) abstract
J#
public abstract int PromptForChoice (
    String caption, 
    String message, 
    Collection<ChoiceDescription> choices, 
    int defaultChoice
)
JScript
public abstract function PromptForChoice (
    caption : String, 
    message : String, 
    choices : Collection<ChoiceDescription>, 
    defaultChoice : int
) : int

Parameters

caption

Text to proceed ( a title) the choices.

message

A message that describes the choice.

choices

A collection of ChoiceDescription objects that describe each choice.

defaultChoice
 

Return Value

The index of the Choices parameter collection element that corresponds to the option selected by the user.

To provide a set of choices that allow the user to select multiple choices, implement the IHostUISupportsMultipleChoiceSelection interface.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, Windows 7, Windows 2008 R2

Target Platforms

Windows Server 2008, Windows Server 2003, Windows Vista, Windows XP, Windows 7, Windows 2008 R2
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker