Using InputBox in C#
Posted by Jeroen Pluimers on 2011/11/03
Sometimes you just want to ask a user for a simple string of input.
The InputBox function is an easy way to do do this. It has a tiny issue with the icon (it uses the one that belongs to the application installation, not the icon in the project properties).
InputBox has been part of Visual Basic since the 90s. And it is very easy to use from C# and other .NET languages:
- Add the Microsoft.VisualBasic assembly (which has been part of the .NET FrameWork since it first got released) to your solution
- Make a call like
Microst.VisualBasic.Interaction.InputBox("Did you know your question goes here?","Title","Default Text");
Sometimes you have to look a bit further than your regular toolbox for simple solutions.
I should dig up my 2006 session on the My Object in Visual Basic: that is also very easy to use in C#.
via: Input Message Box in C#?.