Threading multiple WebBrowser in VB .net

Posted by Code_Seeker on Stack Overflow See other posts from Stack Overflow or by Code_Seeker
Published on 2010-05-03T14:01:09Z Indexed on 2010/05/03 14:08 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

I'm building a multiple webbrowser inside tabs( 1 predefine webbrowser control per tab) and I want them all to load at the same time or other words must run in thread. Unfortunately I feel a valid fact came from the error message that this is something not possible. Pls help me to check my simple program code below and its error in case i tried releasing 2 webbrowser controls but when I leave it to single web browser control it works fine. Any workaround?

Imports System.Threading

Public Class Form1
Dim mythread1 As Thread
Dim mythread2 As Thread

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mythread1 = New Thread(AddressOf mysub1)
mythread2 = New Thread(AddressOf mysub2)
mythread1.IsBackground = True
mythread2.IsBackground = True
mythread1.Start()
mythread2.Start()
End Sub

Public Sub mysub1()
Dim HTML As String
WebBrowser1.Navigate("about:blank")
mythread1.Abort()
End Sub
Public Sub mysub2()
WebBrowser2.Navigate("about:blank")
mythread2.Abort()
End Sub

© Stack Overflow or respective owner

Related posts about threading

Related posts about webbrowser