WebBrowser.CanGoForward : WebBrowser « System.Windows.Forms « C# / C Sharp by API

Home
C# / C Sharp by API
1.Microsoft.Win32
2.System
3.System.Collections
4.System.Collections.Generic
5.System.Collections.Specialized
6.System.ComponentModel
7.System.Configuration
8.System.Data
9.System.Data.Common
10.System.Data.Linq
11.System.Data.Odbc
12.System.Data.OleDb
13.System.Data.Sql
14.System.Data.SqlClient
15.System.Diagnostics
16.System.DirectoryServices
17.System.Drawing
18.System.Drawing.Drawing2D
19.System.Drawing.Imaging
20.System.Drawing.Printing
21.System.Drawing.Text
22.System.EnterpriseServices
23.System.Globalization
24.System.IO
25.System.IO.Compression
26.System.IO.IsolatedStorage
27.System.IO.Ports
28.System.Linq
29.System.Management
30.System.Media
31.System.Messaging
32.System.Net
33.System.Net.Mail
34.System.Net.NetworkInformation
35.System.Net.Sockets
36.System.Reflection
37.System.Resources
38.System.Runtime
39.System.Runtime.CompilerServices
40.System.Runtime.InteropServices
41.System.Runtime.Remoting
42.System.Runtime.Remoting.Channels
43.System.Runtime.Remoting.Channels.Http
44.System.Runtime.Remoting.Messaging
45.System.Runtime.Serialization
46.System.Runtime.Serialization.Formatters.Binary
47.System.Runtime.Serialization.Formatters.Soap
48.System.Security
49.System.Security.AccessControl
50.System.Security.Cryptography
51.System.Security.Cryptography.X509Certificates
52.System.Security.Permissions
53.System.Security.Policy
54.System.Security.Principal
55.System.ServiceProcess
56.System.Text
57.System.Text.RegularExpressions
58.System.Threading
59.System.Timers
60.System.Web.Security
61.System.Web.Services
62.System.Windows.Controls
63.System.Windows.Forms
64.System.Xml
65.System.Xml.Linq
66.System.Xml.Schema
67.System.Xml.Serialization
68.System.Xml.XPath
69.System.Xml.Xsl
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp by API » System.Windows.Forms » WebBrowser 
WebBrowser.CanGoForward
 



using System;
using System.Windows.Forms;

public class SimpleWebBrowser : Form
{
    public SimpleWebBrowser()
    {
        InitializeComponent();
        webBrowser1.Navigate("http://www.java2java.com");
    }

    private void goButton_Click(object sender, EventArgs e)
    {
        webBrowser1.Navigate(textURL.Text);
    }

    private void homeButton_Click(object sender, EventArgs e)
    {
        webBrowser1.GoHome();
    }

    private void backButton_Click(object sender, EventArgs e)
    {
        webBrowser1.GoBack();
    }

    private void forwarButton_Click(object sender, EventArgs e)
    {
        webBrowser1.GoForward();
    }

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        textURL.Text = webBrowser1.Url.ToString();

        if (webBrowser1.CanGoBack)
        {
            backButton.Enabled = true;
        }
        else
        {
            backButton.Enabled = false;
        }

        if (webBrowser1.CanGoForward)
        {
            forwarButton.Enabled = true;
        }
        else
        {
            forwarButton.Enabled = false;
        }
    }

    [STAThread]
    public static void Main(string[] args)
    {
        Application.Run(new SimpleWebBrowser());
    }
    private void InitializeComponent()
    {
        this.webBrowser1 = new System.Windows.Forms.WebBrowser();
        this.goButton = new System.Windows.Forms.Button();
        this.textURL = new System.Windows.Forms.TextBox();
        this.label1 = new System.Windows.Forms.Label();
        this.backButton = new System.Windows.Forms.Button();
        this.homeButton = new System.Windows.Forms.Button();
        this.forwarButton = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // webBrowser1
        // 
        this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));
        this.webBrowser1.Location = new System.Drawing.Point(-22);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(685190);
        this.webBrowser1.TabIndex = 3;
        this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
        // 
        // goButton
        // 
        this.goButton.Location = new System.Drawing.Point(435216);
        this.goButton.Name = "goButton";
        this.goButton.Size = new System.Drawing.Size(4823);
        this.goButton.TabIndex = 1;
        this.goButton.Text = "Go";
        this.goButton.Click += new System.EventHandler(this.goButton_Click);
        // 
        // textURL
        // 
        this.textURL.Location = new System.Drawing.Point(240217);
        this.textURL.Name = "textURL";
        this.textURL.Size = new System.Drawing.Size(18920);
        this.textURL.TabIndex = 2;
        this.textURL.Text = "http://www.java2java.com";
        // 
        // label1
        // 
        this.label1.Location = new System.Drawing.Point(206221);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(3113);
        this.label1.TabIndex = 0;
        this.label1.Text = "Go to:";
        // 
        // backButton
        // 
        this.backButton.Enabled = false;
        this.backButton.Location = new System.Drawing.Point(227249);
        this.backButton.Name = "backButton";
        this.backButton.Size = new System.Drawing.Size(7523);
        this.backButton.TabIndex = 0;
        this.backButton.Text = "<< Back";
        this.backButton.Click += new System.EventHandler(this.backButton_Click);
        // 
        // homeButton
        // 
        this.homeButton.Location = new System.Drawing.Point(308249);
        this.homeButton.Name = "homeButton";
        this.homeButton.Size = new System.Drawing.Size(7523);
        this.homeButton.TabIndex = 0;
        this.homeButton.Text = "Home";
        this.homeButton.Click += new System.EventHandler(this.homeButton_Click);
        // 
        // forwarButton
        // 
        this.forwarButton.Enabled = false;
        this.forwarButton.Location = new System.Drawing.Point(389249);
        this.forwarButton.Name = "forwarButton";
        this.forwarButton.Size = new System.Drawing.Size(7523);
        this.forwarButton.TabIndex = 0;
        this.forwarButton.Text = "Forward >>";
        this.forwarButton.Click += new System.EventHandler(this.forwarButton_Click);
        // 
        // SimpleWebBrowser
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(684303);
        this.Controls.Add(this.forwarButton);
        this.Controls.Add(this.homeButton);
        this.Controls.Add(this.backButton);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.textURL);
        this.Controls.Add(this.goButton);
        this.Controls.Add(this.webBrowser1);
        this.ResumeLayout(false);
        this.PerformLayout();

    }
    private System.Windows.Forms.WebBrowser webBrowser1;
    private System.Windows.Forms.Button goButton;
    private System.Windows.Forms.TextBox textURL;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Button backButton;
    private System.Windows.Forms.Button homeButton;
    private System.Windows.Forms.Button forwarButton;
}

   
  
Related examples in the same category
1.WebBrowser.DocumentTitle
2.WebBrowser.GoForward()
3.WebBrowser.GoHome()
4.WebBrowser.Navigate
5.WebBrowser.Refresh()
6.WebBrowser.Url
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.