没有项目从webcontrol.WebView.BeforeRequestLoad添加到List(来自用户类)

时间:2018-06-03 17:47:33

标签: vb.net visual-studio

没有任何项目从webcontrol.WebView.BeforeRequestLoad

添加到List(来自用户类)

绿色作品,红色 - 没有

enter image description here

Private Sub Captcha_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    webcontrol = New WebControl
    webcontrol.WebView = New WebView
    webcontrol.WebView.Engine = engine
    webcontrol.Dock = DockStyle.Fill
    Panel1.Controls.Add(webcontrol)
    webcontrol.WebView.LoadHtml("http://google.com")
    Form1.UC_tasks1.CaptchaKeysList.Add(New CaptchaKey("Test1", 10))
    AddHandler webcontrol.WebView.BeforeRequestLoad, AddressOf BeforeRequestLoad
End Sub

Public Sub BeforeRequestLoad(sender As Object, e As BeforeRequestLoadEventArgs)
            Form1.UC_tasks1.CaptchaKeysList.Add(New CaptchaKey("Test", 10))
End Sub

Public Class CaptchaKey
Public Key As String
Public Time As Integer
Sub New(Key As String, Time As Integer)
    Me.Key = Key
    Me.Time = Time
End Sub
End Class

1 个答案:

答案 0 :(得分:0)

Invoke(Sub()
                           Form1.UC_tasks1.CaptchaKeysList.Add(New CaptchaKey(CaptchaKey, 10))
                       End Sub)

这很有用,伙计们