Jump to content
xisto Community
rejected

How To Make A Web Browser Visual Basic 6

Recommended Posts

This is a simple and specific tutorial on how to make a basic web browser in Visual Basic 6.

 

Steps 1-3

Create a new project, and then go to "Project" on the menu.

Click components as shown in the following image.

Posted Image

Find the component "Microsoft Internet Controls," check it, and click "Apply" and then "Close."

Posted Image

Click the icon that was just added in the tools window, and draw a large sized window with it. This is going to be where you view webpages through your browser, so don't make it small, but leave room for buttons and other accessories.

 

Steps 4-6

Make a textbox, this will be your URL bar where you type in the address of the website you want to see.

 

Make four command buttons, these are going to be your Go, Back, Forward, and Refresh buttons, change the captions accordingly, and name each of them Cmdgo, Cmdback, CmdForward, and CmdRefresh.

 

Now, here's the coding part. This is all it takes to make your webbrowser working.

Private Sub cmdback_Click() WebBrowser1.GoBack End Sub
Makes the back button go backwards, pretty much self explanatory.

Private Sub Cmdforward_Click() WebBrowser1.GoForward End Sub
Same concept, except this time the webbrowser goes forward.

Private Sub cmdgo_Click() WebBrowser1.Navigate (Text1.Text) End Sub
Makes your webbrowser go to the URL in your text box.

Private Sub cmdrefresh_Click() WebBrowser1.Refresh End Sub
Makes your web browser refresh.

Private Sub Form_Load() WebBrowser1.Navigate ("http://thyelite.com") End Sub
The URL shows your homepage, change it to https://www.google.de/?gfe_rd=cr&ei=7AkjVIatDsKH8QfNkoC4DQ&gws_rd=ssl or whatever your usual homepage you would like to be.

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String) Text1.Text = (WebBrowser1.LocationURL) Form1.Caption = (WebBrowser1.LocationName) End Sub
This changes the text box's text into what URL that you're currently at, and the next line makes the caption of your form into the header of the URL.

 

There you are, a tutorial on how to make a browser, thanks for your time Posted Image.

this is pretty interesting actually,

but if we want to make a really great web browser, i'm sure it's going to be a lot harder than that because it will need a lot more code than that!

Share this post


Link to post
Share on other sites

I have just made my 27th Web Browser I think I will upload them all and then ask members in which one's they like the best :D

Share this post


Link to post
Share on other sites

ah this is quite confusing for me , can any one tell me is there any possible way in creating a browser with the help of C# Dot net , if so can you please guide me , Thanks in Advance :D

Share this post


Link to post
Share on other sites

ah this is quite confusing for me , can any one tell me is there any possible way in creating a browser with the help of C# Dot net , if so can you please guide me , Thanks in Advance :D

Well the system is pretty much the same with VB6 or VB2008 but the coding will be a little more harder. You need to check your toolbox and see if you have the explorer tool. If not right click on the tool box, than go to customize it and check in COM components and search for microsoft webbrowser. Than you put the explorer on your form. The default name/caption of it will be axWebBrowser1. Than you make the buttons and the adress bar. The comands are pretty much the same as I said, Refresh, GoForward , Stop etc.

Here is a sample of code :

private void button1_Click_1(object sender, System.EventArgs e){
System.Object nullObject = 0;
string str = "";
System.Object nullObjStr = str;
Cursor.Current = Cursors.WaitCursor;
axWebBrowser1.Navigate(textBox1.Text, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
Cursor.Current = Cursors.Default;
}
 

private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if ( e.Button == tb1 )
{
axWebBrowser1.GoHome();
}
if ( e.Button == tb2 )
{
axWebBrowser1.Refresh();
}
if ( e.Button == tb3 )
{
axWebBrowser1.GoBack();
}
if ( e.Button == tb4 )
{
axWebBrowser1.GoForward();
}
if ( e.Button == tb5 )
{
axWebBrowser1.Stop();
}
}


Pretty simple eh. If you have anymore questions don't hesitate to pm me :D.

Share this post


Link to post
Share on other sites

Yes, That's true. The kind of browsers made in VB6 or VB2008 are really poor and insecure but nicely done tutorial, even if this are some really basic things in VB6.

And also flashy I don't think it's needed 50 people to do a better browser or almost as good as firefox. If you really know programming than you could do it but it would take some time. I think 10-15 good programmers would be enough.

Cheers!


Yeah true... I just like going over the top on numbers (:

 

--

 

Good tutorial though :D

Share this post


Link to post
Share on other sites

if you are still getting stuck try youtube mate, I have had loads of friends that have got stuck with Codding and Youtube helped them out alot :D.

Share this post


Link to post
Share on other sites

Wow! I can't believe this topic is still active after 3+ years! Anyway, no problem to everyone who's said thanks.

Share this post


Link to post
Share on other sites

FireFox was created in C++, you can download the tarballs since it's an open source project..

Can you please tell me where can i download it from, and moreover you say firefox was written using C++. Was it fully written using C++ , if so i really wonder whether C++ can do such wonders, i just thought its an introductory language to Object Oriented Concepts :)

Share this post


Link to post
Share on other sites

I am programming in VB6.  I am putting together help files in HTML using the Internet Controls as the "browser" for displaying the help files.  I use the keydown event for watching for the F! key to bring all of this into play.  I came to your site seeking a solution to a problem I have encountered.  I still have not found a solution.  Based on what I found on your site; I am doing it correct.   Case vbKeyF1   'Watch for the helper keys   If Shift = 0 Then   frmHelp.Show   With frmHelp.WebHelp   .Navigate ("http://forums.xisto.com/no_longer_exists/ file location")   End With   End IfThe problem I have encountered is when I press F1; I get the help form; but it also brings up Internet Exploder displaying the help files.; the help form shows "this page can not be displayed".  I fail to understand why Internet Exploder can display the page yet the form can not.  Please Help.

-question by Richard

 

Share this post


Link to post
Share on other sites
How do you do it with MS Visual Basic 2008 Express Edition?How To Make A Web Browser

How do you do it with MS Visual Basic 2008 Express Edition?It all works, except the last one it gives a lot of errors in MS VB 2008. What do you do for the 2008 version?

-question by Raymond

 

Share this post


Link to post
Share on other sites

Not a bad tutorial for beginners, but to be honest, this is pretty useless. It uses the pre done internet explorer windows inside, but it strips it of it's function. This makes it the equivalent to internet explorer itself.

Share this post


Link to post
Share on other sites
How to display current url in textboxHow To Make A Web Browser

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)Text1.Text = (WebBrowser1.LocationURL)Form1.Caption = (WebBrowser1.LocationName)End Sub

 

Aparently doesn't seem to work with vb 2005 express.

Any help I'll be thankfull

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.