With threading, the WebBrowser control behaves abnormally.
While other controls allow accessing properties and error out when trying to set it, the WebBrowser control behaves just the opposite. It allows to set the property and errors out when trying to access it.
Anyone knows the reason why?
Here's a small test:
Code:Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim th As New Threading.Thread(AddressOf DoWork3) th.IsBackground = True th.Start() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim th As New Threading.Thread(AddressOf DoWork4) th.IsBackground = True th.Start() End Sub Private Sub DoWork3() TextBox1.Text = "test" '<-- this errors out WebBrowser1.DocumentText = "<html>test</html>" '<-- this works End Sub Private Sub DoWork4() Dim txt = TextBox1.Text '<-- this works Dim wbdoc = WebBrowser1.DocumentText '<-- this errors out End Sub




icon on the left of the post.
Reply With Quote