Febzter Skrevet 14. september 2010 Del Skrevet 14. september 2010 Hei! Jeg vil gjerne adde dette til min browser : i stedet for og navigere til en nettside må jeg trykke på "go" knappen, men jeg vil endre sånn at jeg kan trykke enter. Det hadde også hvert fint om noen kunne lære meg og adde bookmarks og hjemmeside Kode : Public Class Form1 Dim i As Integer = 1 ________________________________________ Private Sub Loading(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) ProgressBar1.Maximum = e.MaximumProgress If Not e.CurrentProgress = -1 And Not e.CurrentProgress > e.MaximumProgress Then ProgressBar1.Value = e.CurrentProgress End If Label1.Visible = True End Sub Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs) TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle ToolStripTextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Url.ToString Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle & "" 'put whatever you want in the parentheses End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Browser As New Windows.Forms.WebBrowser TabControl1.TabPages.Add("New Tab") Browser.Name = "Febzter" Browser.Dock = DockStyle.Fill TabControl1.SelectedTab.Controls.Add(Browser) AddHandler Browser.ProgressChanged, AddressOf Loading AddHandler Browser.DocumentCompleted, AddressOf Done CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoHome() CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ScriptErrorsSuppressed = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).StatusText End Sub Private Sub AddTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabToolStripMenuItem.Click Dim Browser As New Windows.Forms.WebBrowser TabControl1.TabPages.Add("New Tab") TabControl1.SelectTab(i) Browser.Name = "Febzter" Browser.Dock = DockStyle.Fill TabControl1.SelectedTab.Controls.Add(Browser) AddHandler Browser.ProgressChanged, AddressOf Loading AddHandler Browser.DocumentCompleted, AddressOf Done i = i + 1 CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoHome() CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ScriptErrorsSuppressed = True End Sub Private Sub RemoveTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveTabToolStripMenuItem.Click If Not TabControl1.TabPages.Count = 1 Then TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex) TabControl1.SelectTab(TabControl1.TabPages.Count - 1) i = i - 1 End If End Sub Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPrintDialog() End Sub Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPrintPreviewDialog() End Sub Private Sub PageSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetupToolStripMenuItem.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPageSetupDialog() End Sub Private Sub PropertiesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PropertiesToolStripMenuItem.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).ShowPropertiesDialog() End Sub Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click End End Sub Private Sub HideToolbarsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideToolbarsToolStripMenuItem.Click If MenuStrip1.Visible = True And ToolStrip1.Visible = True Then MenuStrip1.Visible = False ToolStrip1.Visible = False Else MenuStrip1.Visible = True ToolStrip1.Visible = True End If End Sub Private Sub TabControl1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.Click 'This keeps it so that when you click on a different tab, the TextBox displays the URL of that tab. ToolStripTextBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Url.ToString Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).DocumentTitle End Sub Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate(ToolStripTextBox1.Text) End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoBack() End Sub Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).GoForward() End Sub Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Stop() End Sub Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Refresh() End Sub Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate("http://www.google.com/search?hl=en&q=" & ToolStripTextBox2.Text & "&btnG=Google+Search") End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Process.Start("http://gamer-news.pcriot.com/") End Sub Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click CType(TabControl1.SelectedTab.Controls.Item(0), Windows.Forms.WebBrowser).Navigate("www.gamer-news.pcriot.com") End Sub Lenke til kommentar
Icaro2 Skrevet 14. september 2010 Del Skrevet 14. september 2010 Prøv dette i keypress eventen din til tekstboksen If (e.KeyChar = ChrW(13)) Then MessageBox.Show("Virker") End If Lenke til kommentar
Prfction Skrevet 21. september 2010 Del Skrevet 21. september 2010 Trykk på formen din -> Ned på Properties -> AcceptButton = Go Da kan du trykke enter, så blir det det samme som og trykke på knappen. Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå