我正在尝试弹出一个输入框,要求用户输入类似于messagebox.show
. 但我希望用户能够在框中输入内容,以便我可以使用返回数据进行验证。
系统将检查用户是否已通过身份验证,否则将通过弹出窗口请求身份验证。
我正在尝试弹出一个输入框,要求用户输入类似于messagebox.show
. 但我希望用户能够在框中输入内容,以便我可以使用返回数据进行验证。
系统将检查用户是否已通过身份验证,否则将通过弹出窗口请求身份验证。
假设您在 WinForms 中,您需要做的是创建一个新表单,为其添加一个文本框和按钮,然后在未通过身份验证时调用它。
public partial class Form1
{
public void Main()
{
bool authenticated = ...
if(!authenticated)
{
Your_Form newForm = new Your_Form();
newForm.Show(this);
string password = newForm.Password;
if(password != "")
...
}
}
}
public class Your_Form
{
public TextBox textBox1 = new TextBox();
// ...
public string Password = "";
private void button1_Click(object sender, EventArgs e)
{
this.Password = textBox1.Text;
}
// ...
}