[c# tutorial] how to make a webbrowser in c#

All tutorials created in C# to be posted in here.
3 posts Page 1 of 1
Contributors
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

hello guys :)

this is my second c# tutorial i am so glad to write this cooll;

so lets get started just start off by making a new project and your form will load then add a webbrowser control from toolbox and add five buttons and change the text as below

button1 - back

button2 - forward

button3 - refresh

button4 - stop

button5 - go

and now add a textbox

time for coding :P

just double click your form and add the whole bunch of code


Code: Select all

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

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

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

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

        private void button3_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            webBrowser1.Stop();
        }

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

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

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
finally make your program look like this


Image

and your done :)

thank me for the tutorial lol lmao;

here you go whole source code in the rar
You do not have the required permissions to view the files attached to this post.
Find my programs on Softpedia
User avatar
DeveloperJacob
VIP - Donator
VIP - Donator
Posts: 87
Joined: Sun May 27, 2012 12:40 pm

Nice Tutorial! cooll;
Image
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 444
Joined: Tue Feb 16, 2010 6:24 am

very nice tutorial :), this brings back when i was coding in XNA, such a pain, but so many uses cooll;
Image
3 posts Page 1 of 1
Return to “C-Sharp Tutorials”