对于循环停止?

时间:2016-11-09 01:27:51

标签: vb.net

Private Sub InstagramHttp()
    Output.Items.Clear()
    Button2.Enabled = False
    StopCheck.Enabled = True
    isRunning = True

    For i = 0 To Names.Items.Count - 1
        Dim name As String = CStr(Names.Items(i))
        Dim Request As HttpWebRequest = CType(WebRequest.Create("https://www.instagram.com/" + name), HttpWebRequest)

        Try
            Dim Response As HttpWebResponse = CType(Request.GetResponse(), HttpWebResponse)
            MessageBox.Show(Response.StatusCode)
            If Response.StatusCode = HttpStatusCode.OK Then
                Continue For
            End If
        Catch ex As System.Net.WebException
            MessageBox.Show(ex.Status)
            If ex.Status = 7 Then
                Output.Items.Add(name)
            End If
            Continue For
        End Try
    Next

    MessageBox.Show("Checker Finished!")
    Button2.Enabled = True
    StopCheck.Enabled = False
End Sub

有我的代码。由于某种原因,状态消息仅显示两次。然后循环完全停止。我得到两个“200”弹出窗口,然后代码不再运行了。列表中有两个以上的元素。

0 个答案:

没有答案