其中控制使用快速文本输入(输入框)?输入框、文本、快速

2023-09-03 01:01:03 作者:簡單陪絆

我需要一个快速的文本输入对话框(消息框在一个单一的文本框)。是否有任何可用的控制或者我应该用一种形式?

I need a quick text input dialog box (MessageBox with a single text box in it). Is there any control available or should I use a form?

我只是想用户输入一些ID。而在其他场合,我想2 texboxes用户名和密码。

I just want user to enter some ID. And in other occasion I want 2 texboxes for username and password.

推荐答案

Microsoft.VisualBasic.dll中有一个InputBox方法,你可以从C#用它来获得一个字符串。

Microsoft.VisualBasic.dll has an InputBox method which you can use from C# to get a single string.

例如(添加引用第一个Microsoft.VisualBasic.dll中)

For example (Add a reference to Microsoft.VisualBasic.dll first)

using Microsoft.VisualBasic;

string response = Interaction.InputBox("Enter a string:", "MyApp", "DefaultString", 0, 0);

Othewise,你必须使自己的形式。

Othewise, you'll have to make your own form.

 
精彩推荐
图片推荐