我的代码正在运行,但我唯一的问题是整个程序在循环时冻结,并且仅在循环完成时冻结才停止,有没有办法摆脱这种冻结?我想看到它从 1 到 21 显示,但它冻结了,只立即显示数字 21。
这是我的代码。我应该改变一些东西以调整它的性能吗?提前致谢
Dim x As Integer = 0
Do
Dim POST As String = "authenticity_token=weZnH8V68yQSnQh91UtDZyatys%2FXtPQGN2vooyW4opY%3D&email%5Bto_address%5D=intes2010%40gmail.com&email%5Bfrom_name%5D=Test&email%5Bfrom_address%5D=test%40email.com&email%5Bnote%5D=today+is+a+big+success&email%5Bcopy_yourself%5D=0&id=house-of-pies-466226000"
Dim request As HttpWebRequest
Dim response As HttpWebResponse
Dim tempCookies As New CookieContainer
request = CType(WebRequest.Create("http://www.yellowpages.com/los-angeles-ca/mip/house-of-pies-466226000/send_email?lid=1000083727260"), HttpWebRequest)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = POST.Length
request.Method = "POST"
request.KeepAlive = True
request.CookieContainer = tempCookies
Dim requestStream As Stream = request.GetRequestStream()
Dim postBytes As Byte() = Encoding.ASCII.GetBytes(POST)
requestStream.Write(postBytes, 0, postBytes.Length)
requestStream.Close()
response = CType(request.GetResponse(), HttpWebResponse)
tempCookies.Add(response.Cookies)
Dim postreader As New StreamReader(response.GetResponseStream())
Dim thepage As String = postreader.ReadToEnd
RichTextBox1.Text = thepage
response.Close()
x = x + 1
Label1.Text = x
Loop While (x <= 20)