共用方式為


HtmlWindow.Prompt Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Displays a dialog box that prompts the user with a message and an input field.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public Function Prompt ( _
    promptText As String _
) As String
public string Prompt(
    string promptText
)

Parameters

  • promptText
    Type: System.String
    Message to display in the dialog box.

Return Value

Type: System.String
The user's input.

Remarks

This method is equivalent to the JavaScript prompt method. It displays the string specified by the promptText parameter and returns a string that contains the user's input.

This method allows nulla null reference (Nothing in Visual Basic) and empty strings for promptText. A null reference is turned into an empty string.

For more information about this method, see the prompt method in the dynamic HTML (DHTML) documentation.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.