Csharp/C Sharp by API/System.Windows.Forms/WebBrowser — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 15:31, 26 мая 2010

WebBrowser.CanGoForward

 

using System;
using System.Windows.Forms;
public class SimpleWebBrowser : Form
{
    public SimpleWebBrowser()
    {
        InitializeComponent();
        webBrowser1.Navigate("http://www.nfex.ru");
    }
    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(-2, 2);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(685, 190);
        this.webBrowser1.TabIndex = 3;
        this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
        // 
        // goButton
        // 
        this.goButton.Location = new System.Drawing.Point(435, 216);
        this.goButton.Name = "goButton";
        this.goButton.Size = new System.Drawing.Size(48, 23);
        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(240, 217);
        this.textURL.Name = "textURL";
        this.textURL.Size = new System.Drawing.Size(189, 20);
        this.textURL.TabIndex = 2;
        this.textURL.Text = "http://www.nfex.ru";
        // 
        // label1
        // 
        this.label1.Location = new System.Drawing.Point(206, 221);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(31, 13);
        this.label1.TabIndex = 0;
        this.label1.Text = "Go to:";
        // 
        // backButton
        // 
        this.backButton.Enabled = false;
        this.backButton.Location = new System.Drawing.Point(227, 249);
        this.backButton.Name = "backButton";
        this.backButton.Size = new System.Drawing.Size(75, 23);
        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(308, 249);
        this.homeButton.Name = "homeButton";
        this.homeButton.Size = new System.Drawing.Size(75, 23);
        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(389, 249);
        this.forwarButton.Name = "forwarButton";
        this.forwarButton.Size = new System.Drawing.Size(75, 23);
        this.forwarButton.TabIndex = 0;
        this.forwarButton.Text = "Forward >>";
        this.forwarButton.Click += new System.EventHandler(this.forwarButton_Click);
        // 
        // SimpleWebBrowser
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(684, 303);
        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;
}


WebBrowser.DocumentTitle

 

using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
    public class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void webBrowser1_DocumentTitleChanged(object sender, EventArgs e)
        {
            this.Text = webBrowser1.DocumentTitle.ToString();
        }
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                webBrowser1.Navigate(textBox1.Text);
            }
        }
        private void webBrowser1_Navigated(object sender,
           WebBrowserNavigatedEventArgs e)
        {
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            buttonBack.Enabled = false;
            buttonForward.Enabled = false;
            buttonStop.Enabled = false;
        }
        private void buttonBack_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonForward_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonStop_Click(object sender, EventArgs e)
        {
            webBrowser1.Stop();
        }
        private void buttonHome_Click(object sender, EventArgs e)
        {
            webBrowser1.GoHome();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }
        private void webBrowser1_CanGoBackChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoBack == true)
            {
                buttonBack.Enabled = true;
            }
            else
            {
                buttonBack.Enabled = false;
            }
        }
        private void webBrowser1_CanGoForwardChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoForward == true)
            {
                buttonForward.Enabled = true;
            }
            else
            {
                buttonForward.Enabled = false;
            }
        }
        private void webBrowser1_Navigating(object sender,
           WebBrowserNavigatingEventArgs e)
        {
            buttonStop.Enabled = true;
        }
        private void webBrowser1_DocumentCompleted(object sender,
           WebBrowserDocumentCompletedEventArgs e)
        {
            buttonStop.Enabled = false;
        }
        private void InitializeComponent()
        {
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.buttonSubmit = new System.Windows.Forms.Button();
            this.buttonRefresh = new System.Windows.Forms.Button();
            this.buttonHome = new System.Windows.Forms.Button();
            this.buttonStop = new System.Windows.Forms.Button();
            this.buttonForward = new System.Windows.Forms.Button();
            this.buttonBack = new System.Windows.Forms.Button();
            this.SuspendLayout();
            this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.webBrowser1.Location = new System.Drawing.Point(15, 74);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Size = new System.Drawing.Size(700, 339);
            this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
            this.textBox1.Location = new System.Drawing.Point(14, 47);
            this.textBox1.Size = new System.Drawing.Size(399, 20);
            this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
            this.buttonSubmit.Location = new System.Drawing.Point(419, 18);
            this.buttonSubmit.Size = new System.Drawing.Size(75, 49);
            this.buttonSubmit.Text = "Submit";
            this.buttonSubmit.UseVisualStyleBackColor = true;
            this.buttonSubmit.Click += new System.EventHandler(this.buttonSubmit_Click);
            this.buttonRefresh.Location = new System.Drawing.Point(338, 18);
            this.buttonRefresh.Size = new System.Drawing.Size(75, 23);
            this.buttonRefresh.Text = "Refresh";
            this.buttonRefresh.UseVisualStyleBackColor = true;
            this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
            this.buttonHome.Location = new System.Drawing.Point(257, 18);
            this.buttonHome.Size = new System.Drawing.Size(75, 23);
            this.buttonHome.Text = "Home";
            this.buttonHome.UseVisualStyleBackColor = true;
            this.buttonHome.Click += new System.EventHandler(this.buttonHome_Click);
            this.buttonStop.Location = new System.Drawing.Point(176, 18);
            this.buttonStop.Size = new System.Drawing.Size(75, 23);
            this.buttonStop.Text = "Stop";
            this.buttonStop.UseVisualStyleBackColor = true;
            this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
            this.buttonForward.Location = new System.Drawing.Point(95, 18);
            this.buttonForward.Size = new System.Drawing.Size(75, 23);
            this.buttonForward.Text = "Forward";
            this.buttonForward.UseVisualStyleBackColor = true;
            this.buttonForward.Click += new System.EventHandler(this.buttonForward_Click);
            this.buttonBack.Location = new System.Drawing.Point(14, 18);
            this.buttonBack.Size = new System.Drawing.Size(75, 23);
            this.buttonBack.Text = "Back";
            this.buttonBack.UseVisualStyleBackColor = true;
            this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(728, 430);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.buttonSubmit);
            this.Controls.Add(this.buttonRefresh);
            this.Controls.Add(this.buttonHome);
            this.Controls.Add(this.buttonStop);
            this.Controls.Add(this.buttonForward);
            this.Controls.Add(this.buttonBack);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button buttonSubmit;
        private System.Windows.Forms.Button buttonRefresh;
        private System.Windows.Forms.Button buttonHome;
        private System.Windows.Forms.Button buttonStop;
        private System.Windows.Forms.Button buttonForward;
        private System.Windows.Forms.Button buttonBack;
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }


WebBrowser.GoForward()

 

using System;
using System.Windows.Forms;
public class SimpleWebBrowser : Form
{
    public SimpleWebBrowser()
    {
        InitializeComponent();
        webBrowser1.Navigate("http://www.nfex.ru");
    }
    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(-2, 2);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(685, 190);
        this.webBrowser1.TabIndex = 3;
        this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
        // 
        // goButton
        // 
        this.goButton.Location = new System.Drawing.Point(435, 216);
        this.goButton.Name = "goButton";
        this.goButton.Size = new System.Drawing.Size(48, 23);
        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(240, 217);
        this.textURL.Name = "textURL";
        this.textURL.Size = new System.Drawing.Size(189, 20);
        this.textURL.TabIndex = 2;
        this.textURL.Text = "http://www.nfex.ru";
        // 
        // label1
        // 
        this.label1.Location = new System.Drawing.Point(206, 221);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(31, 13);
        this.label1.TabIndex = 0;
        this.label1.Text = "Go to:";
        // 
        // backButton
        // 
        this.backButton.Enabled = false;
        this.backButton.Location = new System.Drawing.Point(227, 249);
        this.backButton.Name = "backButton";
        this.backButton.Size = new System.Drawing.Size(75, 23);
        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(308, 249);
        this.homeButton.Name = "homeButton";
        this.homeButton.Size = new System.Drawing.Size(75, 23);
        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(389, 249);
        this.forwarButton.Name = "forwarButton";
        this.forwarButton.Size = new System.Drawing.Size(75, 23);
        this.forwarButton.TabIndex = 0;
        this.forwarButton.Text = "Forward >>";
        this.forwarButton.Click += new System.EventHandler(this.forwarButton_Click);
        // 
        // SimpleWebBrowser
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(684, 303);
        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;
}


WebBrowser.GoHome()

 

using System;
using System.Windows.Forms;
public class SimpleWebBrowser : Form
{
    public SimpleWebBrowser()
    {
        InitializeComponent();
        webBrowser1.Navigate("http://www.nfex.ru");
    }
    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(-2, 2);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(685, 190);
        this.webBrowser1.TabIndex = 3;
        this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
        // 
        // goButton
        // 
        this.goButton.Location = new System.Drawing.Point(435, 216);
        this.goButton.Name = "goButton";
        this.goButton.Size = new System.Drawing.Size(48, 23);
        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(240, 217);
        this.textURL.Name = "textURL";
        this.textURL.Size = new System.Drawing.Size(189, 20);
        this.textURL.TabIndex = 2;
        this.textURL.Text = "http://www.nfex.ru";
        // 
        // label1
        // 
        this.label1.Location = new System.Drawing.Point(206, 221);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(31, 13);
        this.label1.TabIndex = 0;
        this.label1.Text = "Go to:";
        // 
        // backButton
        // 
        this.backButton.Enabled = false;
        this.backButton.Location = new System.Drawing.Point(227, 249);
        this.backButton.Name = "backButton";
        this.backButton.Size = new System.Drawing.Size(75, 23);
        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(308, 249);
        this.homeButton.Name = "homeButton";
        this.homeButton.Size = new System.Drawing.Size(75, 23);
        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(389, 249);
        this.forwarButton.Name = "forwarButton";
        this.forwarButton.Size = new System.Drawing.Size(75, 23);
        this.forwarButton.TabIndex = 0;
        this.forwarButton.Text = "Forward >>";
        this.forwarButton.Click += new System.EventHandler(this.forwarButton_Click);
        // 
        // SimpleWebBrowser
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(684, 303);
        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;
}


WebBrowser.Navigate

 
using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form
{
  private System.Windows.Forms.WebBrowser webBrowser1;
  public Form1() {
        InitializeComponent();
        webBrowser1.Navigate("http://www.nfex.ru");
  }
  private void InitializeComponent()
  {
        this.webBrowser1 = new System.Windows.Forms.WebBrowser();
        this.SuspendLayout();
        // 
        // webBrowser1
        // 
        this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.webBrowser1.Location = new System.Drawing.Point(0, 0);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(600, 600);
        this.webBrowser1.TabIndex = 0;
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(600, 600);
        this.Controls.Add(this.webBrowser1);
        this.Text = "Split Window";
        this.ResumeLayout(false);
  }
  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }
}


WebBrowser.Refresh()

 

using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
    public class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void webBrowser1_DocumentTitleChanged(object sender, EventArgs e)
        {
            this.Text = webBrowser1.DocumentTitle.ToString();
        }
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                webBrowser1.Navigate(textBox1.Text);
            }
        }
        private void webBrowser1_Navigated(object sender,
           WebBrowserNavigatedEventArgs e)
        {
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            buttonBack.Enabled = false;
            buttonForward.Enabled = false;
            buttonStop.Enabled = false;
        }
        private void buttonBack_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonForward_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonStop_Click(object sender, EventArgs e)
        {
            webBrowser1.Stop();
        }
        private void buttonHome_Click(object sender, EventArgs e)
        {
            webBrowser1.GoHome();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }
        private void webBrowser1_CanGoBackChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoBack == true)
            {
                buttonBack.Enabled = true;
            }
            else
            {
                buttonBack.Enabled = false;
            }
        }
        private void webBrowser1_CanGoForwardChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoForward == true)
            {
                buttonForward.Enabled = true;
            }
            else
            {
                buttonForward.Enabled = false;
            }
        }
        private void webBrowser1_Navigating(object sender,
           WebBrowserNavigatingEventArgs e)
        {
            buttonStop.Enabled = true;
        }
        private void webBrowser1_DocumentCompleted(object sender,
           WebBrowserDocumentCompletedEventArgs e)
        {
            buttonStop.Enabled = false;
        }
        private void InitializeComponent()
        {
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.buttonSubmit = new System.Windows.Forms.Button();
            this.buttonRefresh = new System.Windows.Forms.Button();
            this.buttonHome = new System.Windows.Forms.Button();
            this.buttonStop = new System.Windows.Forms.Button();
            this.buttonForward = new System.Windows.Forms.Button();
            this.buttonBack = new System.Windows.Forms.Button();
            this.SuspendLayout();
            this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.webBrowser1.Location = new System.Drawing.Point(15, 74);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Size = new System.Drawing.Size(700, 339);
            this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
            this.textBox1.Location = new System.Drawing.Point(14, 47);
            this.textBox1.Size = new System.Drawing.Size(399, 20);
            this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
            this.buttonSubmit.Location = new System.Drawing.Point(419, 18);
            this.buttonSubmit.Size = new System.Drawing.Size(75, 49);
            this.buttonSubmit.Text = "Submit";
            this.buttonSubmit.UseVisualStyleBackColor = true;
            this.buttonSubmit.Click += new System.EventHandler(this.buttonSubmit_Click);
            this.buttonRefresh.Location = new System.Drawing.Point(338, 18);
            this.buttonRefresh.Size = new System.Drawing.Size(75, 23);
            this.buttonRefresh.Text = "Refresh";
            this.buttonRefresh.UseVisualStyleBackColor = true;
            this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
            this.buttonHome.Location = new System.Drawing.Point(257, 18);
            this.buttonHome.Size = new System.Drawing.Size(75, 23);
            this.buttonHome.Text = "Home";
            this.buttonHome.UseVisualStyleBackColor = true;
            this.buttonHome.Click += new System.EventHandler(this.buttonHome_Click);
            this.buttonStop.Location = new System.Drawing.Point(176, 18);
            this.buttonStop.Size = new System.Drawing.Size(75, 23);
            this.buttonStop.Text = "Stop";
            this.buttonStop.UseVisualStyleBackColor = true;
            this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
            this.buttonForward.Location = new System.Drawing.Point(95, 18);
            this.buttonForward.Size = new System.Drawing.Size(75, 23);
            this.buttonForward.Text = "Forward";
            this.buttonForward.UseVisualStyleBackColor = true;
            this.buttonForward.Click += new System.EventHandler(this.buttonForward_Click);
            this.buttonBack.Location = new System.Drawing.Point(14, 18);
            this.buttonBack.Size = new System.Drawing.Size(75, 23);
            this.buttonBack.Text = "Back";
            this.buttonBack.UseVisualStyleBackColor = true;
            this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(728, 430);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.buttonSubmit);
            this.Controls.Add(this.buttonRefresh);
            this.Controls.Add(this.buttonHome);
            this.Controls.Add(this.buttonStop);
            this.Controls.Add(this.buttonForward);
            this.Controls.Add(this.buttonBack);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button buttonSubmit;
        private System.Windows.Forms.Button buttonRefresh;
        private System.Windows.Forms.Button buttonHome;
        private System.Windows.Forms.Button buttonStop;
        private System.Windows.Forms.Button buttonForward;
        private System.Windows.Forms.Button buttonBack;
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }


WebBrowser.Url

 

using System;
using System.Collections.Generic;
using System.ruponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
    public class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void webBrowser1_DocumentTitleChanged(object sender, EventArgs e)
        {
            this.Text = webBrowser1.DocumentTitle.ToString();
        }
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                webBrowser1.Navigate(textBox1.Text);
            }
        }
        private void webBrowser1_Navigated(object sender,
           WebBrowserNavigatedEventArgs e)
        {
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            buttonBack.Enabled = false;
            buttonForward.Enabled = false;
            buttonStop.Enabled = false;
        }
        private void buttonBack_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonForward_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonStop_Click(object sender, EventArgs e)
        {
            webBrowser1.Stop();
        }
        private void buttonHome_Click(object sender, EventArgs e)
        {
            webBrowser1.GoHome();
            textBox1.Text = webBrowser1.Url.ToString();
        }
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }
        private void webBrowser1_CanGoBackChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoBack == true)
            {
                buttonBack.Enabled = true;
            }
            else
            {
                buttonBack.Enabled = false;
            }
        }
        private void webBrowser1_CanGoForwardChanged(object sender, EventArgs e)
        {
            if (webBrowser1.CanGoForward == true)
            {
                buttonForward.Enabled = true;
            }
            else
            {
                buttonForward.Enabled = false;
            }
        }
        private void webBrowser1_Navigating(object sender,
           WebBrowserNavigatingEventArgs e)
        {
            buttonStop.Enabled = true;
        }
        private void webBrowser1_DocumentCompleted(object sender,
           WebBrowserDocumentCompletedEventArgs e)
        {
            buttonStop.Enabled = false;
        }
        private void InitializeComponent()
        {
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.buttonSubmit = new System.Windows.Forms.Button();
            this.buttonRefresh = new System.Windows.Forms.Button();
            this.buttonHome = new System.Windows.Forms.Button();
            this.buttonStop = new System.Windows.Forms.Button();
            this.buttonForward = new System.Windows.Forms.Button();
            this.buttonBack = new System.Windows.Forms.Button();
            this.SuspendLayout();
            this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.webBrowser1.Location = new System.Drawing.Point(15, 74);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Size = new System.Drawing.Size(700, 339);
            this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
            this.textBox1.Location = new System.Drawing.Point(14, 47);
            this.textBox1.Size = new System.Drawing.Size(399, 20);
            this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
            this.buttonSubmit.Location = new System.Drawing.Point(419, 18);
            this.buttonSubmit.Size = new System.Drawing.Size(75, 49);
            this.buttonSubmit.Text = "Submit";
            this.buttonSubmit.UseVisualStyleBackColor = true;
            this.buttonSubmit.Click += new System.EventHandler(this.buttonSubmit_Click);
            this.buttonRefresh.Location = new System.Drawing.Point(338, 18);
            this.buttonRefresh.Size = new System.Drawing.Size(75, 23);
            this.buttonRefresh.Text = "Refresh";
            this.buttonRefresh.UseVisualStyleBackColor = true;
            this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
            this.buttonHome.Location = new System.Drawing.Point(257, 18);
            this.buttonHome.Size = new System.Drawing.Size(75, 23);
            this.buttonHome.Text = "Home";
            this.buttonHome.UseVisualStyleBackColor = true;
            this.buttonHome.Click += new System.EventHandler(this.buttonHome_Click);
            this.buttonStop.Location = new System.Drawing.Point(176, 18);
            this.buttonStop.Size = new System.Drawing.Size(75, 23);
            this.buttonStop.Text = "Stop";
            this.buttonStop.UseVisualStyleBackColor = true;
            this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
            this.buttonForward.Location = new System.Drawing.Point(95, 18);
            this.buttonForward.Size = new System.Drawing.Size(75, 23);
            this.buttonForward.Text = "Forward";
            this.buttonForward.UseVisualStyleBackColor = true;
            this.buttonForward.Click += new System.EventHandler(this.buttonForward_Click);
            this.buttonBack.Location = new System.Drawing.Point(14, 18);
            this.buttonBack.Size = new System.Drawing.Size(75, 23);
            this.buttonBack.Text = "Back";
            this.buttonBack.UseVisualStyleBackColor = true;
            this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(728, 430);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.buttonSubmit);
            this.Controls.Add(this.buttonRefresh);
            this.Controls.Add(this.buttonHome);
            this.Controls.Add(this.buttonStop);
            this.Controls.Add(this.buttonForward);
            this.Controls.Add(this.buttonBack);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button buttonSubmit;
        private System.Windows.Forms.Button buttonRefresh;
        private System.Windows.Forms.Button buttonHome;
        private System.Windows.Forms.Button buttonStop;
        private System.Windows.Forms.Button buttonForward;
        private System.Windows.Forms.Button buttonBack;
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }