Input Dialog is a simple .net 6-windows, Winforms Input dialog in a nuget package.
20250812: Updated to .Net 9 and C# 13
https://www.nuget.org/packages/InputDialog/
See the sample usage apps in GitHub
- https://github.com/rkreisel/InputDialog/tree/main/InputDialog
- https://github.com/rkreisel/InputDialog/tree/main/InputDialogTester
- https://github.com/rkreisel/InputDialog/tree/main/InputDialogUsageSample
usingInputDialog;namespaceInputDialogUsageSample;publicpartialclassMain:Form{InputDialog.IDIconselectedIcon=InputDialog.IDIcon.Question;publicMain(){InitializeComponent();mnuIconSelectorQuestion.Checked=true;}privatevoidbtnSimpleTextInput_Click(objectsender,EventArgse){vartxt=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";varrslt=InputDialog.InputDialog.ShowDialog(txt,"Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnDefaultInput_Click(objectsender,EventArgse){varrslt=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);}privatevoidbtnChangeButtonName_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("Enter text","Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox,buttonTexts:newButtonTexts{OKText="Do It long button text here"});if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnSimpleMsgBox_Click(objectsender,EventArgse){InputDialog.InputDialog.ShowDialog("This is the message.","Title",selectedIcon,InputDialog.IDButton.OkCancel);}privatevoidbtnComboBoxWithError_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("This is the message.","Title",selectedIcon,InputDialog.IDButton.OkCancel,type:InputDialog.IDType.ComboBox);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnChangeFont_Click(objectsender,EventArgse){if(fd.ShowDialog()==DialogResult.OK){varrslt=InputDialog.InputDialog.ShowDialog("Enter text","Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox,formFont:newFont(fd.Font.FontFamily,fd.Font.Size,fd.Font.Style));if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}}privatevoidbtnChangeBackColor_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("Enter Text","Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox,backgroundColor:Color.AliceBlue);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnChangeForeColor_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("Enter Text","Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox,foregroundColor:Color.Red);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnChangeBothColors_Click(objectsender,EventArgse){varrslt=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);}privatevoidbtnBackgroundImage_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("Enter Text","Title",selectedIcon,InputDialog.IDButton.OkCancel,InputDialog.IDType.TextBox,foregroundColor:Color.White,formFont:newFont("Arial",28,FontStyle.Bold),backgroundImage:Image.FromFile(@"Images\Picture.jpg"),backgroundImageLayout:ImageLayout.Stretch);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatestaticvoidShowResult(stringrslt){MessageBox.Show(rslt,"InputDialog Result",MessageBoxButtons.OK,MessageBoxIcon.Information);}privatevoidbtnEditableComboBox_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("This is the message.","Title",selectedIcon,InputDialog.IDButton.OkCancel,type:InputDialog.IDType.ComboBox,listItems:newList<string>{"Item 1","Item2","Item 3"},acceptsUserInput:true);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidbtnLockedComboBox_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("This is the message.","Title",selectedIcon,InputDialog.IDButton.OkCancel,type:InputDialog.IDType.ComboBox,listItems:newList<string>{"Item 1","Item2","Item 3"},acceptsUserInput:false);if(rslt.DialogResult==DialogResult.OK)ShowResult(rslt.ResultText);}privatevoidmnuIconSelector_Click(objectsender,EventArgse){varsndr=senderasToolStripMenuItem;mnuIconSelectorError.Checked=false;mnuIconSelectorExclamation.Checked=false;mnuIconSelectorInformation.Checked=false;mnuIconSelectorNone.Checked=false;mnuIconSelectorQuestion.Checked=false;varselectedItem=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;}}privatevoidbtnNumericUpDown_Click(objectsender,EventArgse){varrslt=InputDialog.InputDialog.ShowDialog("Use the arrows to select a value.","Title",selectedIcon,InputDialog.IDButton.OkCancel,type:InputDialog.IDType.Numeric,numericProperties:newNumericProperties{//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);}}