Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Public Class Form1
Inherits System.Windows.Forms.Form
Private WithEvents bgw1 As System.ComponentModel.BackgroundWorker
Dim Reader As New System.IO.StreamReader (Application.StartupPath & "\blacklist.txt")
Dim textline As String
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.bgw1.RunWorkerAsync()
End Sub
Public Sub New()
InitializeComponent()
End Sub
Private Sub bgw1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgw1.DoWork
Dim bgw1 As BackgroundWorker = CType(sender, BackgroundWorker)
textline = Reader.ReadLine
Do Until Reader.EndOfStream
If ComboBox1.Text.Contains(textline) Then
bgw1.CancelAsync()
Exit Sub
Else
WebBrowser1.Navigate(ComboBox1.Text)
End If
Loop
End Sub
Private Sub bgw1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgw1.RunWorkerCompleted
Reader.Close()
If e.Cancelled Then
WebBrowser1.Navigate("about
:blank")
End If
Me.bgw1.RunWorkerAsync()
End Sub
End Class