当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET WebBrowser.GoBack方法代码示例

本文整理汇总了VB.NET中System.Windows.Forms.WebBrowser.GoBack方法的典型用法代码示例。如果您正苦于以下问题:VB.NET WebBrowser.GoBack方法的具体用法?VB.NET WebBrowser.GoBack怎么用?VB.NET WebBrowser.GoBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.WebBrowser的用法示例。


在下文中一共展示了WebBrowser.GoBack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1:

' Navigates webBrowser1 to the previous page in the history.
Private Sub backButton_Click( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles backButton.Click

    webBrowser1.GoBack()

End Sub

' Disables the Back button at the beginning of the navigation history.
Private Sub webBrowser1_CanGoBackChanged( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles webBrowser1.CanGoBackChanged

    backButton.Enabled = webBrowser1.CanGoBack

End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:17,代码来源:WebBrowser.GoBack

示例2: WebBrowser.GoBack()

' 导入命名空间
Imports System.Windows.Forms

public class WebBrowserDemo
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class
Public Class Form1

    Private Sub txtURL_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtURL.KeyDown
        If (e.KeyCode = Keys.Enter) Then
            WebBrowser1.Navigate(txtURL.Text)
        End If
    End Sub

    Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
        WebBrowser1.GoBack()
    End Sub

    Private Sub btnForward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForward.Click
        WebBrowser1.GoForward()
    End Sub

    Private Sub btnHome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHome.Click
        WebBrowser1.GoHome()
    End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.ToolStrip1 = New System.Windows.Forms.ToolStrip
        Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel
        Me.txtURL = New System.Windows.Forms.ToolStripTextBox
        Me.btnBack = New System.Windows.Forms.ToolStripButton
        Me.btnForward = New System.Windows.Forms.ToolStripButton
        Me.btnHome = New System.Windows.Forms.ToolStripButton
        Me.WebBrowser1 = New System.Windows.Forms.WebBrowser
        Me.ToolStrip1.SuspendLayout()
        Me.SuspendLayout()

        Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripLabel1, Me.txtURL, Me.btnBack, Me.btnForward, Me.btnHome})
        Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
        Me.ToolStrip1.Size = New System.Drawing.Size(703, 25)

        Me.ToolStripLabel1.Size = New System.Drawing.Size(50, 22)
        Me.ToolStripLabel1.Text = "Address:"

        Me.txtURL.Size = New System.Drawing.Size(200, 25)

        Me.btnBack.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
        Me.btnBack.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.btnBack.Name = "btnBack"
        Me.btnBack.Size = New System.Drawing.Size(33, 22)
        Me.btnBack.Text = "Back"
        '
        'btnForward
        '
        Me.btnForward.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
        Me.btnForward.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.btnForward.Name = "btnForward"
        Me.btnForward.Size = New System.Drawing.Size(51, 22)
        Me.btnForward.Text = "Forward"
        '
        'btnHome
        '
        Me.btnHome.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
        Me.btnHome.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.btnHome.Name = "btnHome"
        Me.btnHome.Size = New System.Drawing.Size(38, 22)
        Me.btnHome.Text = "Home"
        '
        'WebBrowser1
        '
        Me.WebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.WebBrowser1.Location = New System.Drawing.Point(0, 25)
        Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
        Me.WebBrowser1.Name = "WebBrowser1"
        Me.WebBrowser1.Size = New System.Drawing.Size(703, 429)
        Me.WebBrowser1.TabIndex = 1
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(703, 454)
        Me.Controls.Add(Me.WebBrowser1)
        Me.Controls.Add(Me.ToolStrip1)
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "MyBrowser"
        Me.ToolStrip1.ResumeLayout(False)
        Me.ToolStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip
    Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
    Friend WithEvents ToolStripLabel1 As System.Windows.Forms.ToolStripLabel
    Friend WithEvents txtURL As System.Windows.Forms.ToolStripTextBox
    Friend WithEvents btnBack As System.Windows.Forms.ToolStripButton
    Friend WithEvents btnForward As System.Windows.Forms.ToolStripButton
    Friend WithEvents btnHome As System.Windows.Forms.ToolStripButton

End Class
开发者ID:VB程序员,项目名称:System.Windows.Forms,代码行数:108,代码来源:WebBrowser.GoBack


注:本文中的System.Windows.Forms.WebBrowser.GoBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。