-3
一个WebBrowser.DocumentCompleted
事件可以执行BackgroundWorker.RunWorkerAsync()
是否正确?因为我的程序似乎没有执行BackgroundWorker下的代码。web浏览器和BackgroundWorker的VB
代码:
Dim Status As String = ""
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If Status = "Enabled" Or Status = "Disabled" Then
Else
Status = WebBrowser1.Document.GetElementById(Account & "Flag").InnerText.ToString
If Status = "Enabled" Then
BackgroundWorker1.RunWorkerAsync()
ElseIf Status = "Disabled" Then
MessageBox.Show("disabled. Contact admin for more information.", "JKLorenzo", MessageBoxButtons.OK, MessageBoxIcon.Information)
Close()
End If
End If
End Sub
_Have你tried_使得某种指标的讲,如果' RunWorkerAsync()'是否运行?总而言之,开始学习如何使用[**调试器**](https://msdn.microsoft.com/en-us/library/mt243867.aspx)。 –
@VisualVincent我已经解决了它。我几乎重新编写应用程序,以便我可以摆脱之前设置为false的checkforillegalcrossthreadedcalls。那是我的问题,所以我试着逐个修正错误,并且万岁!我做的!虽然谢谢! –
很高兴听到:)!虽然你应该从未将'CheckForIllegalCrossThreadCalls'设置为False ...为了将来的参考,你可以在[** Stack Overflow documentation **]上检查我的关于线程安全的示例(http://stackoverflow.com /documentation/vb.net/1913/threading/6235/performing-thread-safe-calls-using-control-invoke#t=201609071725015139138)。 –