[c#] What is the C# version of VB.net's InputDialog?

To sum it up:

  • There is none in C#.
  • You can use the dialog from Visual Basic by adding a reference to Microsoft.VisualBasic:

    1. In Solution Explorer right-click on the References folder.
    2. Select Add Reference...
    3. In the .NET tab (in newer Visual Studio verions - Assembly tab) - select Microsoft.VisualBasic
    4. Click on OK

Then you can use the previously mentioned code:

string input = Microsoft.VisualBasic.Interaction.InputBox("Prompt", "Title", "Default", 0, 0);

That said, I suggest that you consider the need of an input box in the first place. Dialogs are not always the best way to do things and sometimes they do more harm than good - but that depends on the particular situation.