InputDialog 1.2.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package InputDialog --version 1.2.7                
NuGet\Install-Package InputDialog -Version 1.2.7                
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.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InputDialog --version 1.2.7                
#r "nuget: InputDialog, 1.2.7"                
#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.7

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

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 btnEditableComboBox_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" },
            acceptsUserInput: true); // Technically this is unnecessary as the default is 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",
            InputDialog.InputDialog.IDIcon.Question,
            InputDialog.InputDialog.IDButton.OkCancel,
            type: InputDialog.InputDialog.IDType.ComboBox,
            listItems: new List<string> { "Item 1", "Item2", "Item 3" },
            acceptsUserInput: false);
        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 419 1/28/2024
1.3.0 452 1/3/2024
1.2.9 472 12/14/2023
1.2.8 449 12/8/2023
1.2.7.1 457 12/8/2023
1.2.7 416 12/8/2023
1.2.6.1 402 12/8/2023
1.2.6 434 12/7/2023
1.2.5.1 449 12/7/2023
1.2.5 419 12/7/2023
1.2.4 912 3/8/2022
1.2.3 776 2/26/2022
1.2.2 725 2/26/2022
1.2.1 749 2/13/2022
1.2.0 723 2/5/2022
1.0.2 744 2/3/2022
1.0.1.1 750 1/25/2022
1.0.1 744 1/24/2022
1.0.0.5 735 1/23/2022
1.0.0 765 1/23/2022