-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中獲取文本都可以,但是如果我想要獲取線條,我會收到錯誤消息。
謝謝。