Dim num2 As Integer
Try
Dim num3 As Integer
Label_0000:
ProjectData.ClearProjectError
Dim num As Integer = -2
Label_0008:
num3 = 2
Me.CaptchaPic.ImageLocation = Me.browser.Document.GetElementById("cimg").GetAttribute("src")
Label_0034:
num3 = 3
If Not Me.check Then
goto Label_0060
End If
Label_003E:
num3 = 4
Me.browser.Document.GetElementById("tos_agreed_o_0").InvokeMember("click")
Label_0060:
num3 = 6
Me.tmrCaptcha.Enabled = False
Label_006E:
num3 = 7
Me.check = False
goto Label_00EE
Label_0079:
num2 = 0
Select Case (num2 + 1)
Case 1
goto Label_0000
Case 2
goto Label_0008
Case 3
goto Label_0034
Case 4
goto Label_003E
Case 5, 6
goto Label_0060
Case 7
goto Label_006E
Case 8
goto Label_00EE
Case Else
goto Label_00E3
End Select
Label_00A9:
num2 = num3
Select Case IIf((num > -2), num, 1)
Case 0
goto Label_00E3
Case 1
goto Label_0079
End Select
Catch obj1 As Object When (?)
ProjectData.SetProjectError(DirectCast(obj1, Exception))
goto Label_00A9
End Try
Label_00E3:
Throw ProjectData.CreateProjectError(-2146828237)
Label_00EE:
If (num2 <> 0) Then
ProjectData.ClearProjectError
End If
End Sub
Dim captcha1 As HtmlElement
captcha1 = WebBrowser1.Document.GetElementById("Captcha ID Here")
Dim path As String = captcha1.FirstChild.GetAttribute("src")
My.Computer.Network.DownloadFile(path, "C:\Captcha1.jpg") ' or application path
Webbrowser1.document.getelementbyid("id for textbox where to enter captcha").innertext = textbox1.text
Picturebox1.ImageLocation = "https://ab.login.yahoo.com/img/vMH30.JZFelpq53KSjMRC7hVgxvJQImT7pygFryAvdAIm_llEt6U17UmgYs0nufSo8n8Imp6WsyCDUNHh4vz.pSetd5izNI1GNsm2w--.jpg"
Dim web1 As WebClient = New WebClient
PictureBox1.Image = (New Bitmap(New MemoryStream(web1.DownloadData("captcha url here"))))
Dim captcha1 As HtmlElement
captcha1 = WebBrowser1.Document.GetElementById("cimg")
Dim path As String = captcha1.FirstChild.GetAttribute("src")
My.Computer.Network.DownloadFile(path, "C:\Captcha1.jpg") ' or application path
Public Class Form1
Dim finalresult As String = String.Empty
Private Sub FindValidationCode()
WebBrowser1.Navigate("https://edit.yahoo.com/registration?.src=fpctx&.intl=ca&.done=http://ca.yahoo.com/")
Dim web2 As String = WebBrowser1.Document.Body.InnerHtml
Dim web1 As String = web2
Dim startcode As String = "/img/"
Dim start As Integer = web1.IndexOf(startcode)
Dim end1 As Integer = web1.IndexOf("""")
Dim result1 As String = web1.Remove(0, start + startcode.Length)
Dim result2 As String = result1.Remove(end1, result1.Length - end1)
finalresult = "https://ab.login.yahoo.com/img/" + result2 + "--.jpg"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If WebBrowser1.StatusText = "Done" Then
FindValidationCode()
Picturebox1.ImageLocation = finalresult
Else
MsgBox("Wait for the Webbrowser to load")
End If
End Sub
End Class
