-2
Thread main;
public void bomb()
{
string link = textBox1.Text;
for (int i = 0; i <= richTextBox1.Lines.Length; i++)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + link + "/");
WebProxy myproxy = new WebProxy(this.richTextBox1.Lines[i], false);
//request.Proxy = myproxy;
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
label1.Invoke((MethodInvoker)delegate { label1.Text = i.ToString(); });
}
}
private void button1_Click(object sender, EventArgs e)
{
main = new Thread(bomb);
main.Start();
}
但行: richTextBox1.Lines.Length 和 richTextBox1.Lines [I]线程无法获得访问RichTextBox.Lines
生成错误:
Cross-thread operation not valid: Control 'richTextBox1' accessed from a thread other than >the thread it was created on.
如果我想从richtextbox中获取文本都可以,但是如果我想要获取线条,我会收到错误消息。
谢谢。