Private Sub UpdateComboBoxURL(ByVal urlString As String)
Dim idx As Integer
idx = combobox1.FindStringExact(urlString)
If (idx = -1) Then
idx = combobox1.Items.Add(urlString)
End If
combobox1.SelectedIndex = idx
End Sub
Code (VB.NET)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://google.com")
End Sub
Private Sub LoadPage(ByVal urlString As String)
If String.IsNullOrEmpty(urlString) Then Return
If (Not urlString.StartsWith("http://") And Not urlString.StartsWith("https://")) Then
urlString = "http://" & urlString
End If
WebBrowser1.Navigate(urlString)
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
Private Sub ComboBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles combobox1.KeyDown
If (e.KeyCode = Keys.Enter) Then
LoadPage(combobox1.Text)
End If
End Sub
Private Sub UpdateComboBoxURL(ByVal urlString As String)
Dim idx As Integer
idx = combobox1.FindStringExact(urlString)
If (idx = -1) Then
idx = combobox1.Items.Add(urlString)
End If
combobox1.SelectedIndex = idx
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal urlString As System.Object, ByVal e As System.EventArgs) Handles combobox1.SelectedIndexChanged
End Sub
Private Sub ComboBoxURL_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
End Class