How To Make A Basic Web Browser

Discussion in 'Programming General' started by Dark L3g3nd, Nov 29, 2010.

How To Make A Basic Web Browser
  1. Unread #1 - Nov 29, 2010 at 4:46 PM
  2. Dark L3g3nd
    Joined:
    Mar 9, 2010
    Posts:
    157
    Referrals:
    0
    Sythe Gold:
    0

    Dark L3g3nd Active Member
    Banned

    How To Make A Basic Web Browser

    Well seeing as i have helped a couple of people with this lately i thought i might make this. A web browser was one of my first applications i made.

    Step 1: Requirements
    • Microsoft Visual Studio 2008 C# Edition Download Here
    • A Brain Is Always Good

    Step 2: Creating The Project
    Open up Microsoft Visual Studio 2008 C# Edition and select create project.
    Now you should see something like this:

    [​IMG]


    Choose "Windows Form Application" And then name it Web Browser or whatever, then click Ok.


    Step 3: Creating The GUI Side Of The Browser
    Now you should see something like this:

    [​IMG]


    Make it a bit bigger so it should now look like this:

    [​IMG]


    Now go into your Tool Box and Drag five buttons and a Text Box And A Label onto the GUI

    [​IMG]

    [​IMG]

    [​IMG]

    Now rename the buttons to: ()=The button number you use.By Doing This:

    Back(Button1), Forward(Button2), Stop(Button3), Refresh(Button4), Go(Button5), URL(Label1).


    [​IMG]


    Also rename the title of your application by clicking on the top of it where the close button is etc, and then do how you did for the buttons.


    Now drag them and line them up across the top and put them in this order.
    Code:
    [Back] [Forward] [Stop] [Refresh] {Label} (Text Box) [Go]
    It should now look like this:

    [​IMG]

    Now go back to your Tool Box and drag a Web Browser Control to your GUI and expand it to all the space left.

    [​IMG]

    It should now look something like this:

    [​IMG]


    Step 4: Adding The Code
    Ok so now we have our GUI done but if you click the buttons it won't do anything. We need to add the functions to the buttons. Let's start with the Back button.
    Double click the back button.


    Now in between the { and the } it brings you to add this:

    Code:
    webBrowserControl1.GoBack();
    This tells your web browser to go back pretty simple aye?


    Now let's do the Forward button double click it and in between the { and } it brings you to add this:

    Code:
    webBrowserControl1.GoForward();
    This tells your web browser to go forward.

    Now it's time for the Stop button so double click and in between the { and } it brings you to add this:

    Code:
    webBrowserControl1.Stop();
    This Tells your web browser to Stop, easy as pie don't you think?

    Now lets do the Refresh button so double click it and in between the { and } it brings you to add this:

    Code:
    webBrowserControl1.Refresh();
    This Tells your web browser to refresh.

    Now the Go button is the one that is a bit different, so double click it and in between the { and } it brings you to add this:

    Code:
    webBrowserControl1.Navigate(textBox1.Text);
    This tells your web browser to go to whatever address is in the text box you added.

    Your end code should look like this:

    Code:
    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 Web_Browser
    {
        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.GoForward();
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                webBrowser1.Stop();
            }
    
            private void button4_Click(object sender, EventArgs e)
            {
                webBrowser1.Refresh();
            }
    
            private void button5_Click(object sender, EventArgs e)
            {
                webBrowser1.Navigate(textBox1.Text);
            }
        }
    }
    
    Step 5: Building Your Project
    We're all done now i recommend you save and you will need to build your web browser by doing this:

    [​IMG]


    Now go to where you saved it to and open the folder then go Bin>>Release>>Web Browser (or whatever you named it) and double click it.

    Enjoy
     
  3. Unread #2 - Dec 28, 2010 at 5:57 AM
  4. uselesspoop
    Joined:
    Oct 3, 2007
    Posts:
    1,670
    Referrals:
    0
    Sythe Gold:
    0

    uselesspoop Guru
    Banned

    How To Make A Basic Web Browser

    This is very interesting. Good and detailed guide .
     
  5. Unread #3 - Mar 23, 2011 at 7:57 PM
  6. Jeezal
    Joined:
    Mar 23, 2011
    Posts:
    285
    Referrals:
    0
    Sythe Gold:
    0

    Jeezal Forum Addict

    How To Make A Basic Web Browser

    detailed, do you think you can help me out however.
     
  7. Unread #4 - Apr 10, 2011 at 11:48 PM
  8. CrackerJack59
    Joined:
    Feb 6, 2011
    Posts:
    1,399
    Referrals:
    0
    Sythe Gold:
    0

    CrackerJack59 Guru
    Banned

    How To Make A Basic Web Browser

    Nice, im learning to use C# atm. I like this guide.
     
  9. Unread #5 - Jun 27, 2011 at 1:56 PM
  10. Xeroti
    Joined:
    Nov 10, 2010
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0

    Xeroti Member

    How To Make A Basic Web Browser

    This looks really nice! Gonna follow it now, I hope it raises my C# knowledge a little.
     
< C++ Help VERY URGENT | I sell fresh cc fullz dumps track1&2 paypal.............moneymaker forums powered by >

Users viewing this thread
1 guest


 
 
Adblock breaks this site