Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 14th, 2007, 5:45 PM   #1
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Creating a Web Browser

Right, this is my attempt to give back to the community and help out the even more noobish than I. I thought I'd write about something really simple that I could do in my sleep so there was no chance I'd get it wrong!:

This tutorial will tell you how to create a web browser in less than 10 minutes and is actually really easy:

I use Microsoft's VB.NET as a compiler. It's really easy to use and does most of the hard work for you. If you have not yet downloaded and installed it, then do so. Create a new Windows Application (File --> New) and then resize the default form to your liking!

The main part of the web browser is contained within the next stage. From the toolbox, drag a WebBrowser onto the form and make it the dimensions you want. Next drag a text box and button underneath it. Call the web browser "browser1", the text box "tbox1" and the button "button1".

Now for the actual coding. Double click on the button and add the following code in the appropriate place:


browser1.Navigate(tbox1.Text)


Now exit code view and press F5 to run. Your own web browser! In less than the time it takes to start IE (almost - lol)! Any questions or if it doesn't work please let me know!
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jul 14th, 2007, 8:57 PM   #2
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0 King is an unknown quantity at this point
Why would you give your control names like tbox1 and button1? That is horrible naming convention. Something like txtURL and btnNavigate are far more suitable because they actually explain what the control might be used for.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 15th, 2007, 5:21 AM   #3
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
King, I also am addicted to Linux - still that is totally irrelevant for now so I won't get into it.

In a small program like that there is no point - I just type the first thing which comes into my rather unimaginative mind. It's a tiny program with only one button in it so it's obvious which one you'd be referring to so why not call it "Bob" or "Jim" or something. LOL.

But thanks for the advice and I might further follow this new convention in some of my longer programs rather than just calling the long names including their x and y coordinates. LOL.
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jul 15th, 2007, 11:10 AM   #4
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0 King is an unknown quantity at this point
If this wasn't a tutorial and you were just showing it off I wouldn't have said anything, but it is, so you should be teaching people new to programming good practices such as naming convention even on a small app like that.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 15th, 2007, 11:54 AM   #5
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Yes well I doubt anyone's going to be looking at it anyway so is there really any point complaining? Why be so negative?
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jul 15th, 2007, 4:20 PM   #6
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0 King is an unknown quantity at this point
I was a bit negative in the first post, not in the second. The second one I was just explaining why you should have properly named the controls... especially because you went through the trouble of changing the control name, so it would take no extra effort in naming it something a bit more descriptive.

Enough of that. I remember in high school programming in VB6 when I discovered the WebBrowser control (about 4 years ago), I was one happy dude. I spend 2 weeks adding my own buttons and all that stuff. It was pretty slick lol.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 15th, 2007, 6:07 PM   #7
Ben.Dougall
Programmer
 
Ben.Dougall's Avatar
 
Join Date: Jul 2007
Location: London, Ontario, Canada
Posts: 34
Rep Power: 0 Ben.Dougall is on a distinguished road
Send a message via MSN to Ben.Dougall
never seen/heard of said control... must look into this. but nonetheless, always rename the controls... readability is always good to have no matter the project.
__________________
My site :: http://www.freewebtown.com/dougalbe
I'll try to be nicer, if you try being smarter.
Ben.Dougall is offline   Reply With Quote
Old Jul 15th, 2007, 7:09 PM   #8
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 377
Rep Power: 0 King is an unknown quantity at this point
Quote:
Originally Posted by Ben.Dougall View Post
never seen/heard of said control... must look into this.
I wouldn't bother. The control is based off of IE and doesn't seem to perform as well, with no options to fuss with the inner workings of it. It's just a fun exercise when you are first learning how to program in VB/C#. Other than that there is really no use to it unless you really hate the look of IE or Firefox.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jul 16th, 2007, 2:00 AM   #9
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Excuse me. Any sort of program that you want to display a page of the web (quite a few that I've done recently actually) this command is very, very useful.
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jul 16th, 2007, 2:21 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's a fairly common control, these days. For example, wxWidgets has one. The question is: how closely does the rendering conform to W3C recommendations in its entirety? Generally speaking, I would say, "not very".

In the following illustration, the box at the bottom of the window is an html control. After initializing it (size, position, etc.), I merely have to treat it as a object that has some predefined methods. For example, "myHtmlControl.LoadFile ("hootchiefile.htm"). All the work (however comprehensive that may be) was done by someone else. Bless their li'l peapickin' hearts.

__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Special browser in Java (Project) stalefish Java 3 Feb 9th, 2008 4:22 PM
Browser With PHP Bulit In PhilBon PHP 5 Dec 4th, 2006 11:43 PM
building a browser toolbar va1damar Java 2 Mar 20th, 2006 9:29 AM
creating browser toolbar va1damar Project Ideas 2 Mar 15th, 2006 2:45 PM
creating an application that stands between the browser and the serve ronias Visual Basic 5 Oct 30th, 2005 4:22 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC