DialogsInputDialog(IWin32Window, String, String, String) Method

Displays an input dialog with an editable value, and OK and Cancel buttons.

Definition

Namespace: KGySoft.WinForms.Forms
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public static bool InputDialog(
	IWin32Window? owner,
	string? caption,
	string? prompt,
	ref string value
)

Parameters

owner  IWin32Window
An optional window that will own the modal input dialog. If , the DialogsOwner property will be taken. If DialogsOwner is also , the currently active window will be used.
caption  String
The caption of the dialog. If , the name of the application is used.
prompt  String
A prompt text, explaining the purpose of the input dialog. If , a localized string of Value: is used.
value  String
A reference to a string that contains the initial value of the input field. When this method returns , this parameter will contain the value entered by the user.

Return Value

Boolean
if the user clicked OK or pressed Enter, if the user clicked Cancel, pressed Esc or closed the dialog.

Remarks

  Note

In versions prior to 5.0.0, the caption and the prompt were translated by the obsolete Language class. Since version 5.0.0, the parameters are expected to be already localized. To use the same dynamic localization as BaseForm or BaseUserControl when their DynamicStringLocalization property is set to AssemblyScope or LocalScope, you can use the LocalizationHelper.GetString method. To localize default prompt text and buttons, set the LanguageSettings.DynamicResourceManagersSource property to CompiledAndResX in the startup code of your application, and translate the auto-generated KGySoft.WinForms.Messages.<LanguageId>.resx files in the Resources folder of the executing application.

To use a right-to-left layout when the UI culture of the current thread is a right-to-left language, set the AutoRightToLeftLayout property to before calling this method.

See Also