Getting user input in C #

Is there a way to get user input like input in C #, for example? I would like a window to pop up to ask the user to enter a string

+3
source share
1 answer

C # itself does not have such a function, assuming you are using Winforms, but you can steal it from the default VB.NET libraries (from the namespace Microsoft.VisualBasic):

using Microsoft.VisualBasic;

class Program
{
    static void Main()
    {
       var response = Interaction.InputBox("Enter some text!", "Title", "Default text");
    }
}

See MSDN for more details .

You can also create your own window using WinForms (or WPF) if you need to do something more specific.

+8
source

Source: https://habr.com/ru/post/1740707/


All Articles