如何在C Sharp中使用InputBox [英] How to use an InputBox in C Sharp
本文介绍了如何在C Sharp中使用InputBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我想在C Sharp GUI中使用InputBox.我该怎么做?
Hello, I want to use an InputBox in a C Sharp GUI. How can I do that?
推荐答案
请参见 ^ ].
@ shakil0304003:InputBox
是一种VB函数,其工作原理类似于MessageBox
,只有您得到一个文本框,您可以在其中输入内容并在用户单击确定"时检索它.
在我看来,InputBox
是一个愚蠢的函数,因为您无法限制用户的输入(您可以在以后进行验证,但是用户可以在框中输入他想要的任何内容).加:看起来像sh * t ...
使用标签,文本框和确定/取消"按钮自己简单地创建表格会更好.这样,您还可以设计盒子,使其与其余应用程序的外观相匹配.它只需要几行代码...
如果您绝对坚持使用InputBox
函数,那么我相信它仍然存在于Microsoft.VisualBasic
名称空间中.
看看此 [
@ shakil0304003:InputBox
is a VB function that works sort of like aMessageBox
, only that you get a textbox where you can enter something and retrieve it when the user clicks ok.
In my opinion,InputBox
is a stupid function because you have no way of restricting the user input (you can validate it afterwards, but the user can write anything he wants in the box). Plus: It looks like sh*t...
Much better to simply do a form yourself with a label, a textbox and ok/cancel buttons. That way you can also design the box to match the look and fell of the rest of your application. It will only require a few more lines of code...
If you absolutely insist on using theInputBox
function, I''m sure it still exists somewhere in theMicrosoft.VisualBasic
namespace.
Have a look at This[^][/EDIT]
InputBox已从C#中完全删除,实际上它不需要那.相反,您可以根据自己的喜好创建它.只需创建一个表单并添加一个文本框,然后将其用作输入框即可.
InputBox is totally removed from C# and actually it doesnt need that. Rather you can create it of your own if you like. Just create a form and add a textbox and use it as an InputBox.
这篇关于如何在C Sharp中使用InputBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文