Web Browser Controls

| |

WebBrowserControls

C# Visual Studio 2010 Project C# WebBrowser

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WebBrowser
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

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

		private void btnBack_Click(object sender, EventArgs e)
		{
			if (webBrowser1.CanGoBack == true)
			{
				webBrowser1.GoBack();
			}
		}

		private void btnForward_Click(object sender, EventArgs e)
		{
			if (webBrowser1.CanGoForward == true)
			{
				webBrowser1.GoForward();
			}
		}
	}
}

VB.NET Visual Studio 2010 Project VB.NET WebBrowser

Public Class Form1

Private Sub btnNavigate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNavigate.Click
	WebBrowser1.Navigate(txtAddressBar.Text)
End Sub

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

Private Sub btnFoward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFoward.Click
	If WebBrowser1.CanGoForward Then
		WebBrowser1.GoForward()
	End If
End Sub
End Class
Originally Posted on April 11, 2013
Last Updated on March 3, 2016
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.