01.
Public
Class
Form1
02.
03.
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
05.
End
Sub
06.
Private
Sub
LoadPage(
ByVal
urlString
As
String
)
07.
If
String
.IsNullOrEmpty(urlString)
Then
Return
08.
09.
If
(
Not
urlString.StartsWith(
"http://"
)
And
Not
urlString.StartsWith(
"https://"
))
Then
10.
urlString =
"http://"
& urlString
11.
End
If
12.
WebBrowser1.Navigate(urlString)
13.
End
Sub
14.
Private
Sub
WebBrowser1_DocumentCompleted(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
Handles
WebBrowser1.DocumentCompleted
15.
16.
End
Sub
17.
18.
Private
Sub
ComboBox1_KeyDown(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.Windows.Forms.KeyEventArgs)
Handles
combobox1.KeyDown
19.
20.
If
(e.KeyCode = Keys.Enter)
Then
21.
LoadPage(combobox1.Text)
22.
End
If
23.
24.
End
Sub
25.
Private
Sub
UpdateComboBoxURL(
ByVal
urlString
As
String
)
26.
Dim
idx
As
Integer
27.
idx = combobox1.FindStringExact(urlString)
28.
29.
If
(idx = -1)
Then
30.
idx = combobox1.Items.Add(urlString)
31.
End
If
32.
combobox1.SelectedIndex = idx
33.
End
Sub
34.
35.
36.
37.
38.
39.
40.
Private
Sub
ComboBox1_SelectedIndexChanged(
ByVal
urlString
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
combobox1.SelectedIndexChanged
41.
42.
43.
End
Sub
44.
45.
46.
47.
48.
Private
Sub
ComboBoxURL_SelectedIndexChanged(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
49.
50.
End
Sub
51.
End
Class