通過賬戶列表這將循環一次在proxyList每一個項目,如果在帳戶列表5項和10 proxyList那麼這段代碼將循環50次。這段代碼沒有什麼問題,除非它不符合你想要的。
從您的評論你想爲accountList和proxyList雙方提前向前一視同仁,你應該定義一個新類:
Public Class ProxyAccount
Public Proxy As String
Public Account As String
End Class
那麼你的代碼變成:
Public Class Form1
Public ProxyList As New List(Of ProxyAccount)
For Each pa As ProxyAccount In ProxyList
Dim a as String = pa.Account
Dim z() As String = a.Split(":")
Dim p as String = pa.Proxy
' SENDS WEBREQUESTS BY USING ACCOUNTS AND SETS PROXY '
Next
Next
End Class
或者你也可以做到這一點以及:
Public Class Form1
Public ProxyList As New List(Of String)
Public AccountList As New List(Of String)
For i as Integer = 0 To ProxyList.Count - 1
If i >= AccountList.Count Then
Exit For
End If
Dim a As String = AccountList(i)
Dim z() As String = a.Split(":")
Dim p as String = ProxyList(i)
' SENDS WEBREQUESTS BY USING ACCOUNTS AND SETS PROXY '
Next
End Class
這兩個工作都很好,但你會想要重構代碼以更清潔。
'AccountList'中有多少個字符串? – Tim
超過150+,但它只是不跳過第一個。 – Zozo
你是否已經在調試器中逐步完成代碼?是否拋出任何異常?如果你在'AccountList'初始化的地方顯示代碼,這可能會有所幫助。 – Tim