内部循环功能不正常

时间:2017-02-20 17:09:08

标签: vb.net visual-studio

我有一个代码,它应该从ListBox中获取元素并通过代码尝试滚动它们,该代码从那里尝试每个值,直到找到正确的值(使用WebBrowser):

 Public Function ParseWordList() As String
 Dim count As Integer
        For count = 0 To ListBox2.Items.Count - 1
            Dim l_text As String = CStr(ListBox2.Items(count))
            Return l_text
        Next
    End Function

*还告诉我,即使这个功能在某种程度上是错误的

主要的一个,使用之前发布的其他功能:

  Private Sub Timer9_Tick(sender As Object, e As EventArgs) Handles Timer9.Tick
        If docCompleted2 Then Exit Sub
        Button3.Enabled = True
        Do
            ProgressBar2.Value = 0
            ProgressBar1.Value = 0
            If docCompleted2 Then docCompleted2 = False
            If WebBrowser1.Document.GetElementById("tbtLoginID") IsNot Nothing Then
                WebBrowser1.Document.GetElementById("tbtLoginID").SetAttribute("value", TextBox5.Text)
            End If
            Dim gen2 As String
            gen2 = ParseWordList()
            ListBox1.Items.Add(gen2)
            If WebBrowser1.Document.GetElementById("tbtPassword") IsNot Nothing Then
                WebBrowser1.Document.GetElementById("tbtPassword").SetAttribute("value", gen2)
            End If
            If WebBrowser1.Document.GetElementById("div_123") IsNot Nothing Then
                WebBrowser1.Document.InvokeScript("rockLogin")
            End If
            ProgressBar2.Value = ProgressBar2.Value + 50
            ProgressBar1.Value = ProgressBar1.Value + 1
            ProgressBar2.Value = ProgressBar2.Value + 50
            If Integer.TryParse(Label5.Text, intValue1) Then
                intTotal = intValue1
            End If
            intValue1 = intValue1 + 1
            Label5.Text = intValue1
            docCompleted2 = True
            If docCompleted2 = True Then
                WebBrowser1.Navigate("hidden")
                WaitForPageLoad()
                WaitMate()
                Label1.Text = WebBrowser1.Document.GetElementById("nickName").GetAttribute("innerText")
            Else
                WebBrowser1.Navigate("hidden")
                WaitForPageLoad()
                WaitMate()
                Label1.Text = WebBrowser1.Document.GetElementById("nickName").GetAttribute("innerText")
                ProgressBar2.Value = ProgressBar2.Value + 50
                If Integer.TryParse(Label5.Text, intValue1) Then
                    intTotal = intValue1
                End If
                intValue1 = intValue1 + 1
                Label5.Text = intValue1
                ProgressBar1.Value = ProgressBar1.Value + 1
                ProgressBar2.Value = ProgressBar2.Value + 50
            End If
        Loop
    End Sub

我得到了什么错误?没什么,只是函数只使用列表框中的第一个元素,我希望它一个接一个地使用它们,但我不知道该怎么做,甚至不知道要搜索什么。

如果标题错了或者我没有关注正确的观点,请不要责怪我,我知道出了什么问题,相信我在来这里之前尝试了很多东西:(

0 个答案:

没有答案
相关问题