InputDialog 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package InputDialog --version 1.2.0
NuGet\Install-Package InputDialog -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InputDialog" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InputDialog --version 1.2.0
#r "nuget: InputDialog, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install InputDialog as a Cake Addin
#addin nuget:?package=InputDialog&version=1.2.0

// Install InputDialog as a Cake Tool
#tool nuget:?package=InputDialog&version=1.2.0

Input Dialog

Input Dialog is a simple .net 6-windows, Winforms Input dialog in a nuget package.

https://www.nuget.org/packages/InputDialog/

Usage

(See the sample usage app in GitHub - https://github.com/rkreisel/InputDialog)

using InputDialog;

namespace InputDialogUsageSample;

public partial class Main : Form
{
    public Main()
    {
        InitializeComponent();
    }

    private void btnSimpleTextInput_Click(object sender, EventArgs e)
    {
        var txt = cmLongText.Checked
            ? "This can be a long piece of text. This test is to show how the feature works. This is a really long chunk of text. I just want to see how it scrolls when it gets too long for the window."
            : "Enter Text";
        var rslt = InputDialog.InputDialog.ShowDialog(
            txt,
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnDefaultInput_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            defaultText: "Default Text");
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnChangeButtonName_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            buttonTexts: new ButtonTexts { OKText = "Do It!" });
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnSimpleMsgBox_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "This is the message.",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel);
    }

    private void btnComboBox_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "This is the message.",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            type: InputDialog.InputDialog.IDType.ComboBox,
            listItems: new List<string> { "Item 1", "Item2", "Item 3" });
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnComboBoxWithError_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "This is the message.",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            type: InputDialog.InputDialog.IDType.ComboBox);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnChangeFont_Click(object sender, EventArgs e)
    {
        if (fd.ShowDialog() == DialogResult.OK)
        {
            var rslt = InputDialog.InputDialog.ShowDialog(
                "Enter text",
                "Title",
                InputDialog.InputDialog.IDIcon.Question,
                InputDialog.InputDialog.IDButton.OkCancel,
                InputDialog.InputDialog.IDType.TextBox,
                formFont: new Font(fd.Font.FontFamily, fd.Font.Size, fd.Font.Style));
            if (rslt.DialogResult == DialogResult.OK)
                ShowResult(rslt.ResultText);
        }
    }

    private void btnChangeBackColor_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter Text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            backgroundColor: Color.AliceBlue);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnChangeForeColor_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter Text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            foregroundColor: Color.Red);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnChangeBothColors_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter Text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            foregroundColor: Color.White,
            backgroundColor: Color.DarkBlue);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private void btnBackgroundImage_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Enter Text",
            "Title",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            InputDialog.InputDialog.IDType.TextBox,
            foregroundColor: Color.White,
            formFont: new Font("Arial", 28, FontStyle.Bold),
            backgroundImage: Image.FromFile(@"Images\Picture2.jpg"),
            backgroundImageLayout: ImageLayout.Stretch);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

    private static void ShowResult(string rslt)
    {
        MessageBox.Show(rslt, "InputDialog Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on InputDialog:

Package Downloads
TextViewer

A simple popup text file viewer in a Nuget package. Version 1.0.4 adds XML comments.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 342 1/28/2024
1.3.0 418 1/3/2024
1.2.9 445 12/14/2023
1.2.8 422 12/8/2023
1.2.7.1 432 12/8/2023
1.2.7 391 12/8/2023
1.2.6.1 381 12/8/2023
1.2.6 408 12/7/2023
1.2.5.1 425 12/7/2023
1.2.5 393 12/7/2023
1.2.4 883 3/8/2022
1.2.3 750 2/26/2022
1.2.2 700 2/26/2022
1.2.1 726 2/13/2022
1.2.0 698 2/5/2022
1.0.2 716 2/3/2022
1.0.1.1 730 1/25/2022
1.0.1 717 1/24/2022
1.0.0.5 713 1/23/2022
1.0.0 741 1/23/2022