Prompt Dialog in Windows Forms

前端 未结 11 1443
名媛妹妹
名媛妹妹 2020-11-30 19:47

I am using System.Windows.Forms but strangely enough don\'t have the ability to create them.

How can I get something like a javascript prompt dialog, wi

11条回答
  •  我在风中等你
    2020-11-30 20:18

    Add reference to Microsoft.VisualBasic and use this into your C# code:

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

    To add the refernce: right-click on the References in your Project Explorer window then on Add Reference, and check VisualBasic from that list.

提交回复
热议问题