我正在开发一款软件,它将模拟浏览器登录,并执行一些GET
请求POST
,服务器有时需要访问用户输入的校验码。
所以我制作了一个表单让用户输入校验码但是当我尝试将参数传递到校验码表单时,它无法将值设置为用户在文本框中输入的值。
这是代码CheckcodeForm.cs
public partial class CheckcodeForm : Form
{
public string pic_url;
public string ck;
public CheckcodeForm()
{
InitializeComponent();
}
public CheckcodeForm(string _ck,string pic_url)
{
InitializeComponent();
this.pic_url = pic_url;
this.ck = _ck;
pictureBox1.ImageLocation = pic_url;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
this.pictureBox1.ImageLocation = pic_url;
}
private void button1_Click(object sender, EventArgs e)
{
this.ck = this.textBox1.Text;
this.Hide();
}
}
这是新的CheckcodeForm
部分:
string _check_code = "0000";
new CheckcodeForm(_check_code,checkcodePicUrl).ShowDialog();
MessageBox.Show(_check_code);
为什么我总是收到 0000 的消息框?