+ Reply to Thread
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45

Thread: Creating A Simple Web Browser.

  1. #1
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Cool Creating A Simple Web Browser.

    Today I'm going to show you how to make a simple web browser with all the basic features like home back forward refresh ect...

    So to get started you with our web browser make a new windows forms application and name it MyWebBrowser or whatever you want.

    OK now add a new Tool Strip to the top of the form(Tool Strip can be found in the tool box in the menu and toolbars tab) OK now add a Web Browser to the center of the form and size it to the size you want.(Web Browser is at the very bottom of the common controls tab in the tool box)

    OK now we need some buttons for our form so click on the Tool Strip you placed on the top of the form and there should be a little blue box that pops up left click it and a picture button will pop up do this intel you have 5 picture buttons. Now click the little arrow on the Tool Strip add thing and select text box then add one more picture button.

    Now right click the text box and goto properties and change the name to URLBox and the text to URL then scroll down and find the size setting and change the width to a size according to your form.

    So now your form should look like this:


    Now right click one of your picture buttons and goto properties and find the image setting and change the image to what you want. Repeat for the rest and you'll have:


    Now right click the web browser and goto properties and set it's name to webBrowser and it's URL to a web site like Google or something.

    OK now for some actual code.

    Double click the back button on the tool strip and add this code.
    Code:
    webBrowser.GoBack();
    That does exactly what you would think it does.

    OK double click the forward button on the tool strip and add this code.
    Code:
    webBrowser.GoForward();
    Now double click the home button on the tool strip and add this code.
    Code:
    webBrowser.GoHome();

    Now double click the stop button on the tool strip and add this code.
    Code:
    webBrowser.Stop();
    Then double click the refresh button on the tool strip and add this code.
    Code:
    webBrowser.Refresh();
    Now the last thing we need to do is make our address bars text usable for the web browser to navigate with.

    So what we do is add code to our Go button.
    Code:
    webBrowser.Navigate(URLBox.Text);
    (tip don't forget http:// when typing in the address bar)

    Congratulations you just made your own web browser.
    I hope you enjoyed this tutorial, as always +rep and comments/questions are welcome.
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Nov 2009
    Location
    London
    Posts
    866
    Blog Entries
    3
    Rep Power
    14

    Re: Creating A Simple Web Browser.

    Cool made a new browser + rep!

  4. #3
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Re: Creating A Simple Web Browser.

    Thanks.
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

  5. #4
    Bartimäus's Avatar
    Bartimäus is offline Programming Expert
    Join Date
    Dec 2009
    Location
    Germany
    Posts
    490
    Rep Power
    11

    Re: Creating A Simple Web Browser.

    nice tut + rep (sorry i can't rep you at the moment try it later again)

  6. #5
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Re: Creating A Simple Web Browser.

    Thanks.
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

  7. #6
    cismarel is offline Learning Programmer
    Join Date
    May 2009
    Location
    Romania
    Posts
    37
    Rep Power
    0

    Re: Creating A Simple Web Browser.

    Thanks for tut! But how can the adress bar show the page where I am?

  8. #7
    gokuajmes's Avatar
    gokuajmes is offline Programming God
    Join Date
    Jan 2010
    Location
    India
    Posts
    516
    Blog Entries
    5
    Rep Power
    12

    Re: Creating A Simple Web Browser.

    Quote Originally Posted by Bartimäus View Post
    nice tut + rep (sorry i can't rep you at the moment try it later again)
    Thats one Big Avatar you got

  9. #8
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Re: Creating A Simple Web Browser.

    Thanks for tut! But how can the adress bar show the page where I am?
    This should do the trick:
    Code:
    textBox1.Text = Convert.ToString(webBrowser1.Url);
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

  10. #9
    cismarel is offline Learning Programmer
    Join Date
    May 2009
    Location
    Romania
    Posts
    37
    Rep Power
    0

    Re: Creating A Simple Web Browser.

    thank you thegamemaker, now I have another question. When I type and adress into the textbox i want to navigate to that adress by pressing enter instead of pressing click on the Go button.

  11. #10
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Re: Creating A Simple Web Browser.

    thank you thegamemaker, now I have another question. When I type and adress into the textbox i want to navigate to that adress by pressing enter instead of pressing click on the Go button.
    Im pretty sure you could do this:
    Code:
    private void textBox1_KeyDown(KeyEventArgs keyEvent)
            {
                if (keyEvent.KeyCode == Keys.Enter)
                {
                    webBrowser1.Navigate(url);
                }
            }
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

+ Reply to Thread
Page 1 of 5 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating Browser/Web based games, How to?
    By Unknown2dark in forum The Lounge
    Replies: 4
    Last Post: 02-07-2011, 03:48 AM
  2. Creating your own web browser (in code)
    By Ironwil in forum General Programming
    Replies: 3
    Last Post: 01-13-2011, 03:45 AM
  3. Simple Java web browser
    By farrell2k in forum Java Tutorials
    Replies: 5
    Last Post: 10-24-2010, 03:33 AM
  4. Creating A Simple Compiler: Part 1
    By dargueta in forum C Tutorials
    Replies: 29
    Last Post: 09-21-2010, 08:08 AM
  5. Creating my own simple CMS with PHP and MySQL HELP!
    By Coldhearth in forum PHP Development
    Replies: 13
    Last Post: 11-19-2008, 01:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts