Primer 5- Primena objekta Web Browser
Option Explicit
Private Sub cmdDesno_Click()
On Error GoTo EH
WebBrowser1.GoForward
Exit Sub
EH:
Resume Next
End Sub
Private Sub cmdIzlaz_Click()
Unload Me
End Sub
Private Sub cmdLevo_Click()
On Error GoTo EH
WebBrowser1.GoBack
Exit Sub
EH:
Resume Next
End Sub
Private Sub cmdOsvezi_Click()
WebBrowser1.Refresh
End Sub
Private Sub cmdStani_Click()
WebBrowser1.Stop
End Sub
Private Sub cmdTrazi_Click()
TraziURL
End Sub
Private Sub TraziURL()
WebBrowser1.Navigate txtIme.Text
End Sub
Private Sub Form_Load()
WebBrowser1.GoHome
End Sub
Private Sub mnuIzlaz_Click()
Unload Me
End Sub
Private Sub mnuOprogramu_Click()
frmAbout.Show
End Sub
Private Sub txtIme_DblClick()
Dim sFile As String
With dlgCommonDialog
.DialogTitle = "Open"
.CancelError = False
.Filter = "HTML file (*.htm)|*.htm"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
sFile = .FileName
End With
txtIme.Text = sFile
End Sub
Private Sub txtIme_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TraziURL
End If
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
txtIme.Text = URL
End Sub
Private Sub WebBrowser1_TitleChange(ByVal Text As String)
frmMojExplorer.Caption = Text
End Sub