简体   繁体   English

在弹出框中输入文本

[英]Enter Text in PopUp Box

I'd like my prog to pop up a box in which the user can enter text to store it in a variable. 我想让我的程序弹出一个框,用户可以在其中输入文本以将其存储在变量中。 Do i have to create a new form for this? 我是否需要为此创建一个新表格?

If you only need to input one string at a time, you could use Microsoft.VisualBasic.Interaction.InputBox . 如果一次只需要输入一个字符串,则可以使用Microsoft.VisualBasic.Interaction.InputBox

If you need to be able to input more than one string or other things (like a selection from a dropbox or a date from a calendar), you will need to implement your own control. 如果您需要能够输入多个字符串或其他内容(例如,从保管箱中进行选择或从日历中获取日期),则需要实现自己的控件。

Update: Here is an SO question that will help you out a bit more. 更新: 是一个SO问题,可以帮助您更多。 It's fairly similar to yours in that the answer is the same, but I think your question is different enough to not be considered a duplicate. 答案是一样的,这与您的答案非常相似,但是我认为您的问题与众不同,不能被视为重复。

您无需填写新表格,请在此处查看此示例

假设您使用的是WinForms, 应该会对您有所帮助,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM