how do you get a web page into a vb form? I am not looking for just the picture. I want the actual page to be in the form, like my own browser.
Thanx
Printable View
how do you get a web page into a vb form? I am not looking for just the picture. I want the actual page to be in the form, like my own browser.
Thanx
Use the Webbrowser Control (ShDocVw.dll) which is a part of IE. It is located in the Custom Controls (Ctrl+T) under Microsoft Internet Controls.
Commands mostly used:
Code:'Go to the previous webpage
WebBrowser1.GoBack
'Go to the present webpage
WebBrowser1.GoForward
'Go to the default IE home
WebBrowser1.GoHome
'Go to the default search page
WebBrowser1.GoSearch
'Refresh the current webpage
WebBrowser1.Refresh
'Navigate to a webpage
WebBrowser1.Navigate "www.vb-world.net"
Thanx for the quick response. also, I posted this yesterday. Do you know how to login with an x id. I am on a t1 line.
Matthrew, what you posted on the Microsoft Inet Control will make a new instance of IE. I was wondering if you know a way to view that right on one of my child form?
Wow, I did respond quick, didn't even realize it.
Here is the thread that shows what you want to do.
And I'm not sure how to log on to an x id..whatever that is :rolleyes:.
Sorry for being slow, but I am still lost with your example.
There are two controls under that dll. what is the ShellFileViewOC?
Did you accidently go to References? To do it manually, click on Browse or whatever is there to select a ocx file, and located in the C:\Windows\System directory with a file called ShDocVw.dll. You are talking about the Custom Controls, aren't you? There should be one named Microsoft Internet Controls.
I did what you told to do. control T. when I checked on it, there are two controls that appears. the browsers and the ShellFolderViewOC.
I pasted your codes on too the form, but still nothing appears.
Thanx for helping Mattrew.
Private Sub Form_Click()
Dim ppDisp As Object
Dim F As New Form1
Set ppDisp = F.WebBrowser1.object
F.Show
End Sub
When you went into Custom Controls (Ctrl+T), did you do the other alternative: click on Browser... and select C:\Windows\System\ShDocVw.dll ? After you select it, it should automatically put it in the list and go to it, than you just make sure it's checked and click OK.
Sorry if I am confusing you. I got the control on my form already. It has an icon of the earth. I dropped the control on my form but still don't see any http://www.yahoo.com on my form. again, i don't have trouble locating the control, but why isn't the webbrowser control displaying the yahoo site?
thanx for your help. I got it working now. I pasted the code above into it. thanx again Matthrew.
Did you forget to navigate to the site?
Code:Private Sub Form_Load()
Webbrowser1.Navigate "http://www.yahoo.com"
End Sub
Thanx you!
How can I view the addressbar? I set it to true already but it is not visible.
I ask you this earlier about x id. It is another name for the network id. at my company, to login to the internet, I have to enter the network id. do you know how to enter it through codes?
Thanx
[Edited by Shark on 10-06-2000 at 01:06 AM]
I don't think the address bar would show and I have no idea why. Make your own.
And if you want to have a status bar:Code:Private Sub Command1_Click()
Webbrowser1.Navigate Combo1.text
End Sub
For the x id, I think you have to do it yourself..unless you use SendKeys to do it.Code:Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Label1.Caption = Text
End Sub
And if you need help with anything else for the Webbrowser Control, just ask.
You are great. Make others people lifes come easier. Thanx so much!
OK, I thought of a question for you. I got this code from you. you posted for someone somewhere.
webbrowser1.execwb savecopyas, donotprompt
How come it still prompt me when I wanted to save a jpeg?
Webbrowser Control is just like that. It always prompts you for stuff. If you look in the Object Browser at the Webbrowser Control, you will see many things in it. Some of those things work...and some don't. It gives you an error when you try to do certain things. Even if you download IE 5.5, it still does it. I guess Microsoft can't work out every bug(s) :rolleyes:. I guess your going to have to...
By the way, are you wanting to save everything on the Web page? Here is how you do it:Quote:
Live it, learn it, love it.
Notice: If you switch PROMPTUSER to DONTPROMPTUSER, it does not work. The user must choose where it is to be saved.Code:WebBrowser1.ExecWB OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER
Thanks Matthrew. I just thought of an idea. I am using IE5 on Win2k. When you load a picture or a file, it has to cache out to somewhere. So, instead of using Webbrowser1.Execwb, why not just copy it from the cache? This way the save dialog box can be avoid. Only problem is where does it cache out the file? Have any ideas?
The folder where it's cached is "C:\WINDOWS\Temporary Internet Files"
That might be on win9x but not on win2k.
I have two more questions Matthrew.
Web.Document.Forms(0).login.Value
What else can I do with Document and why is Forms(0) but not Forms(1222). What does the zero represent?
Thanks
If you ever studied html, then you know the <form> tag. A form is a piece in an html that contains controls. Controls like command buttons, text buttons, etc. Forms(0) means the first form in the web page.Quote:
Originally posted by Shark
Why is Forms(0) but not Forms(1222). What does the zero represent?
This is for Matthrew.
Quote:
Matthrew. I just thought of an idea. I am using IE5 on Win2k. When you load a picture or a file, it has to cache out to somewhere. So, instead of using Webbrowser1.Execwb, why not just copy it from the cache? This way the save dialog box can be avoid. Only problem is where does it cache out the file? Have any ideas?
You might want to check this site out.
http://support.microsoft.com/support.../Q244/7/57.ASP
Thanks Nitro.
While looking at that site, I stumble into URLDownloadToCacheFile. Can you show me how to use that too.
Hey shark ,
no need to use the web browser control.
insert a module declare this api call ...
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function GetActiveWindow Lib "user32" () As Long
then ...
Private Sub mnuGotoURL_Click()
surl = "http://www.vb-world.net"
ShellExecute GetActiveWindow(), "Open", surl, "", 0&, 1
End Sub
hope this solves ya prob ....
later .... :)
Thanks but I don't want to open a new IE browser because I need the end user to browse in the form of my project.
Using the ShellExecute will launch a new instance.
There is an example right on Vb-World.net for how to use the URLDownloadToFile function.Quote:
Originally posted by Shark
Thanks Nitro.
While looking at that site, I stumble into URLDownloadToCacheFile. Can you show me how to use that too.
Thanks Matthrew but I am looking how to use URLDownloadToCacheFile not URLDownloadToFile.
The site that nitro provided talks little about it, but provide no sytax for the api.
Thanks for looking.