Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

webcontrol on a vb.net form 1

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
I know this has been asked before, but i have looked the post and still cant figure it out.
i want to display html on a form. i am converting a vb6 form to vb.net and cant figure out how to add a webcontrol, which is what is on the vb6 form!!!

please help
 

Sounds simple huh?

I wanted to do the same thing and searched forever for it on various search engines to no avail. Then I stumbled on an answer. I'm not sure this is the best solution or where I found it but:

in the Visual Studio IDE, right-click in the toolbox panel, select 'Customize Toolbox...', go to the 'Com Components' tab. Look for 'Microsoft Web Browser' (default location is "c:\WINDOWS\system32\shdocvw.dll"). Select the checkbox and click OK.

-Stephen Paszt

 
ok, i have got the control on my form and all look ok.
ihave the following code, i was hoping it was going to display the htm file but nothing happens the form loads with a blank white Explorer control.

I get the the following messages

"File found"
then
"something went wrong with the html.."

Try
If File.Exists("d:\PreMessage" & sLangID & ".htm") Then
MsgBox("found file")

'set the html control = the file name
'#######################################################
'########## HTML control ################################
'########################################################

frmMain.txt1frmMain.Visible = False
frmMain.AxWebBrowser1.Visible = True
frmMain.AxWebBrowser1.Navigate("d:\PreMessage" & sLangID & ".htm")


End If
Catch
MsgBox("something went wrong with the HTML page nav")
End Try


any ideas????

thanks,
mrmovie
 
If you open up that file directly in internet explorer, do you get an error?
 
no it opens up fine, get a load of text and the page looks fine
 
It'd probably help to know what the actual error is. You can change your [tt]Catch[/tt] to [tt]Catch ex As Exception[/tt]. Then change your MsgBox to:
[tt]MsgBox(ex.Message)[/tt]

[tt]MsgBox(ex)[/tt] would give even more information, but it's probably more than you need to know what happened here.
 
The ex.Message says

"the requested resource is in use"

please dont tell me i cant have IE open at the same time!
i dont have the target file open and no other process has it open
 
nope doesnt seem to matter if IE is open already
 
i dont have the associated
Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As Object, _
ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) _
Handles AxWebBrowser1.NavigateComplete2

sub in my project,,,does that make any difference??
 
Try the Navigate2 method of the Web Browser control.

Navigate2 method remarks:
"This method extends the Navigate method to allow for shell integration; however, the original Navigate method can still be used for URL navigations (Navigate2 does not make Navigate obsolete)."
_______________________________________________
Not having the NavigateComplete2 event handler in your project isn't the problem. This event fires when part of the document has been received from the server, and the viewer for the document has been created. I usually use it to display the current URL. I would normally add it to a combo box, but for simplicity:

Code:
textbox1.Text = AxWebBrowser1.LocationURL.ToString

Here's a useful link to info about the properties, methods, and events of the Web Browser Control:

-Stephen Paszt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top