/// <summary> /// Displays a prompt dialog with the given message. /// </summary> /// <param name="p_wndOwner">The owner of the prompt window.</param> /// <param name="p_strPrompt">The prompt message.</param> /// <param name="p_strCaption">The title of the dialog window.</param> /// <param name="p_strDefault">The default prompted text.</param> /// <param name="p_strValidationPattern">The regular expression to use to validate the entered text.</param> /// <param name="p_strErrorMessage">The error message to display if the entered text fails validation.</param> /// <returns>The entered prompted text, or <c>null</c> if the user /// cancelled the dialog.</returns> public static string ShowDialog(IWin32Window p_wndOwner, string p_strPrompt, string p_strCaption, string p_strDefault, string p_strValidationPattern, string p_strErrorMessage) { PromptDialog dlgPrompt = new PromptDialog(); dlgPrompt.Text = p_strCaption; dlgPrompt.EnteredText = p_strDefault; dlgPrompt.Prompt = p_strPrompt; dlgPrompt.ValidationPattern = p_strValidationPattern; dlgPrompt.ValidationErrorMessage = p_strErrorMessage; if (dlgPrompt.ShowDialog(p_wndOwner) == DialogResult.OK) return dlgPrompt.EnteredText; return null; }