InputDialog 1.3.1

dotnet add package InputDialog --version 1.3.1
NuGet\Install-Package InputDialog -Version 1.3.1
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.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InputDialog --version 1.3.1
#r "nuget: InputDialog, 1.3.1"
#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.3.1

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

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 apps in GitHub

using InputDialog;

namespace InputDialogUsageSample;

public partial class Main : Form
{
    InputDialog.IDIcon selectedIcon = InputDialog.IDIcon.Question;

    public Main()
    {
        InitializeComponent();
        mnuIconSelectorQuestion.Checked = true;
    }

    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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            InputDialog.IDType.TextBox,
            defaultText: "Default Text",
            multilineTextbox : false);
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }

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

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

    private void btnComboBoxWithError_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "This is the message.",
            "Title",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            type: 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",
                selectedIcon,
                InputDialog.IDButton.OkCancel,
                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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            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",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            InputDialog.IDType.TextBox,
            foregroundColor: Color.White,
            formFont: new Font("Arial", 28, FontStyle.Bold),
            backgroundImage: Image.FromFile(@"Images\Picture.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);
    }

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

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

    private void mnuIconSelector_Click(object sender, EventArgs e)
    {
        var sndr = sender as ToolStripMenuItem;
        mnuIconSelectorError.Checked = false;
        mnuIconSelectorExclamation.Checked = false;
        mnuIconSelectorInformation.Checked = false;
        mnuIconSelectorNone.Checked = false;
        mnuIconSelectorQuestion.Checked = false;
        var selectedItem = sndr?.Text;
        switch (selectedItem)
        {
            case "Error":
                selectedIcon = IDIcon.Error;
                mnuIconSelectorError.Checked = true;
                break;
            case "Exclamation":
                selectedIcon = IDIcon.Exclamation;
                mnuIconSelectorExclamation.Checked = true;
                break;
            case "Information":
                selectedIcon = IDIcon.Information;
                mnuIconSelectorInformation.Checked = true;
                break;
            case "Question":
                selectedIcon = IDIcon.Question;
                mnuIconSelectorQuestion.Checked = true;
                break;
            default:
                selectedIcon = IDIcon.Nothing;
                mnuIconSelectorNone.Checked = true;
                break;
        }
    }

    private void btnNumericUpDown_Click(object sender, EventArgs e)
    {
        var rslt = InputDialog.InputDialog.ShowDialog(
            "Use the arrows to select a value.",
            "Title",
            selectedIcon,
            InputDialog.IDButton.OkCancel,
            type: InputDialog.IDType.Numeric,
            numericProperties: new NumericProperties 
            {
                //Try out these options that change the display
                //Increment = 1,
                //Maximum = 100,
                //Minimum = 1,
                //Value = 9999,
                //DecimalPlaces = 2, ThousandsSeparator = true,
                //UpDownAlign = LeftRightAlignment.Left,
                //HorizontalAlignment = HorizontalAlignment.Center
            },
            acceptsUserInput: true);;
        if (rslt.DialogResult == DialogResult.OK)
            ShowResult(rslt.ResultText);
    }
}


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 333 1/28/2024
1.3.0 417 1/3/2024
1.2.9 444 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 380 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 882 3/8/2022
1.2.3 749 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 715 2/3/2022
1.0.1.1 729 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