Simple Input Dialog In C#

Muhammad's Blog

Have you ever tried looking for a Input Dialog box in C#? I did recently and fully expecting something similar to the MessageBox.Show() found out that there wasn’t one. So I browsed the web for a quick solution, and did’nt find exactly what I wanted so I decided to make my own. Here is how I did it for those of you facing the same problem.

Just to be clear, my goals were :

  • Simple looking dialog, with caption, description, and a textbox.
  • Option to press ok and also cancel out.
  • Easy way to return the value.

Okay lets start, create a form named InputDialog.cs with the following code in InputDialog.Designer.cs but make sure you rename the namespace to your own :

Now you should have a form that looks like this :

Newly created input dialog

Now this form needs some code behind it to function, so clear everything behind it and paste…

View original post 36 more words

Leave a comment