Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

FORM 1 CODE ONLY

By: Unknowngama on Nov 22nd, 2011  |  syntax: None  |  size: 4.42 KB  |  views: 7,341  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. FORM1 Only:
  2.  
  3.  
  4. Dim int As Integer = 0
  5.     Dim Favorites As String = "C:\app.favorites.dat"
  6.     Dim SW As IO.StreamWriter
  7.  
  8.      
  9. Form1 Load:
  10.         Dim Browser As New WebBrowser
  11.         TabControl1.TabPages.Add("New Page")
  12.         Browser.Name = "Web Browser"
  13.         Browser.Dock = DockStyle.Fill
  14.         TabControl1.SelectedTab.Controls.Add(Browser)
  15.         AddHandler Browser.ProgressChanged, AddressOf Loading
  16.         AddHandler Browser.DocumentCompleted, AddressOf Done
  17.         int = int + 1
  18.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.Homepage)
  19.  
  20.         If IO.File.Exists(Favorites) = False Then
  21.             IO.File.Create(Favorites)
  22.         Else
  23.         End If
  24.  
  25.        
  26.       Timer1:
  27.         ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
  28.  
  29.     Stop:
  30.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
  31.    
  32.  
  33.     Go/Navigate:
  34.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
  35.         ComboBox1.Items.Add(ComboBox1.Text)
  36.         History.ListBox1.Items.Add(ComboBox1.Text)
  37.    
  38.  
  39.      Home:
  40.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.Homepage)
  41.  
  42.    
  43.     Refresh:
  44.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
  45.    
  46.  
  47.     Forward:
  48.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
  49.    
  50.  
  51.     Back:
  52.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
  53.    
  54.     Search:
  55.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.google.com/search?sourceid=navclient&ie=UTF-8&r­lz=1T4SUNA_enUS296US296&q=" & TextBox1.Text)
  56.    
  57.    Remove Tab:
  58.         If Not TabControl1.TabPages.Count = 1 Then
  59.             TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
  60.             TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
  61.             int = int - 1
  62.         End If
  63.    
  64.  
  65.     Add Tab:
  66.         Dim Browser As New WebBrowser
  67.         TabControl1.TabPages.Add("New Page")
  68.         TabControl1.SelectTab(int)
  69.         Browser.Name = "Web Browser"
  70.         Browser.Dock = DockStyle.Fill
  71.         TabControl1.SelectedTab.Controls.Add(Browser)
  72.         AddHandler Browser.ProgressChanged, AddressOf Loading
  73.         AddHandler Browser.DocumentCompleted, AddressOf Done
  74.         int = int + 1
  75.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(My.Settings.Homepage)
  76.    
  77.  
  78.     Website Properties:
  79.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog()
  80.  
  81.     Exit:
  82.         End
  83.      
  84.  
  85.    Loading:
  86.     Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)
  87.         ToolStripProgressBar1.Maximum = e.MaximumProgress
  88.         ToolStripProgressBar1.Value = e.MaximumProgress
  89.     End Sub
  90.  
  91.  
  92.    Done:
  93.     Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs)
  94.         TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
  95.         ComboBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
  96.     End Sub
  97.  
  98.     New Window:
  99.         Dim f As New Form1
  100.         f.Show()
  101.    
  102.  
  103.     Print:
  104.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPrintDialog()
  105.    
  106.  
  107.     Print Preview:
  108.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPrintPreviewDialog()
  109.    
  110.     Page Setup
  111.         CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPageSetupDialog()
  112.  
  113.     Using Enter for ComboBox:
  114.          Private Sub ComboBox1_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
  115.         If e.KeyCode = Keys.Enter Then
  116.             CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
  117.         End If
  118.     End Sub
  119.  
  120.  
  121.    Using Enter for TextBox:
  122.    
  123.     Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
  124.         If e.KeyCode = Keys.Enter Then
  125.             CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.google.com/search?sourceid=navclient&ie=UTF-8&r­lz=1T4SUNA_enUS296US296&q=" & TextBox1.Text)
  126.         End If
  127.     End Sub
  128.    
  129. End Class