Cara Membuat Web Browser Sederhana dengan Visual Basic 6
Kali ini Team.NET akan berbagi tutorial dan sourcecode cara membuat web browsing sederhana dengan visual basic 6.
Langsung saja ikutin langkah-langkah dibawah ini :
- Buka Visual Basic 6 Trus pilih Standard EXE.
- Klik Kanan Pada ToolBox, Kemudian pilih Components atau tekan key Ctrl + T .
- Kemudian Cari dan Centang Microsoft html object library, Microsoft internet controls, Microsoft Windows common Controls 5.0 atau 6.0 sama saja.
- Buat 5 Command Buton, 1 Text Box , 1Label, 1 Webbrowser , 1 Proggress Bar. Dengan Nama Seperti dibawah ini :
- 5 buah Command Button : GoBack, GoForward, Go, Refresh, Stop
- 1 buah Web Browser : WebBrowser1
- 1 buah Progress Bar : ProgressBar1
- 1 buah Text Box : Text1
- 1 buah Label : Label1
Saran saya tata Seperti Gambar di bawah.
- Label Captionnya maslisman ganti dengan Done
- TextBox Text Kosongin saja.
Sekarang kita Masukkan kode kode berikut, caranya doble klik pada tool / tombol yang sudah kita buat.
On Error Resume Next
WebBrowser1.GoBack
On Error Resume Next
WebBrowser1.GoForward
On Error Resume Next
WebBrowser1.Refresh
On Error Resume Next
WebBrowser1.Stop
On Error Resume Next
WebBrowser1.Navigate Text1.Text
- Progress Bar. Langsung Copy dan Paste Code ini pada Form Code
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
On Error Resume Next
If Progress = -1 Then ProgressBar1.Value = 100
Label1.Caption = "Done"
ProgressBar1.Visible = False
If Progress > 0 And ProgressMax > 0 Then
ProgressBar1.Visible = True
Image1.Visible = False
ProgressBar1.Value = Progress * 100 / ProgressMax
Label1.Caption = "Loading " & Int(Progress * 100 / ProgressMax) & "%"
End If
Exit Sub
End Sub
- Resize Form. Langsung Copy dan Paste Code ini pada Form Code
Private Sub Form_Resize()
On Error Resume Next
WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight - 1680
End Sub
- Selesai, coba jalankan / tekan F5 dan jika sudah tak tampak error. Langsung pilih File > Make Project1.exe.
Jika Program sudah jadi akan terlihat seperti ini :