我敲了一段最简单的代码程序 觉得没问题 可是不成 大家看一哈 哪里错了 提示
有问题的地方在Combo1_KeyPress事件中
代码如下:
Private Sub Combo1_Click()
Dim urlstring As String
urlstring = Combo1.Text
WebBrowser1.Navigate (urlstring)
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Dim urlstring As String
Dim i As Integer
urlstring = Trim(Combo1.Text)
If Mid(urlstring, 1, 4) <> "http" Then
urlstring = "http://" & Combo1.Text & ".com"
End If
WebBrowser1.Navigate (urlstring)
Combo1.Text = urlstring
For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = Combo1.Text Then
Exit Sub
End If
Next
Combo1.AddItem urlstring
End Sub
Private Sub Command1_Click()
Dim urlstring As String
Dim i As Integer
urlstring = Trim(Combo1.Text)
If Mid(urlstring, 1, 4) <> "http" Then
urlstring = "http://www." & Combo1.Text & ".com"
End If
WebBrowser1.Navigate (urlstring)
Combo1.Text = urlstring
For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = Combo1.Text Then
Exit Sub
End If
Next
Combo1.AddItem urlstring
End Sub