|
-
April 5th, 2003, 12:24 PM
#1
How to display HTML - based pages in VB ?
I am going to make a VB.Net project where it is necessary to display HTML pages (like in Internet Explorer) which should be loaded from Web Server (IIS). Is it possible and how ?
-
April 6th, 2003, 10:05 AM
#2
I've seen a friend of mine using the COM Microsoft Web Browser to display HTML file from within VB.NET app.
Right-click on your toolbox and choose Customize Toolbox option from the pop-up menu. Then choose Microsoft Web Browser control from the COM Component tab.
Now you should have an icon on your toolbox that is called Microsoft Web Browser and in your REFERENCES folder (project explorer), you'll have AxSHDocVw (the DLL for the web browser).
Just drag the Web Browser icon on your form and use the available methods to load up HTML file.
-Cool Bizs
-
July 3rd, 2003, 08:22 AM
#3
slight alteration of original question
i want to do the same thing, but i dont want to display a htlm file, i want to more or less display a string in some kind of control that will parse the string's html tags and display correctly, kinda like a richtext box with text set to "<b>this is bold</b>" but displays "this is bold" in a bold font so you don't see the tags etc.
is there something out there to do this or do i need to write my own parser????
ipsteal
Man, I really want my name to be IPSteal, not ipsteal but i can't find out how to change it!!!
-
July 3rd, 2003, 08:42 AM
#4
Yes, the web browser control supports what you've asked for. For a simple example, do what coolbiz has instructed and then create a simple html page on to ur desktop.
AxWebBrowser1.Navigate("c:\myhtm.htm")
or
AxWebBrowser1.Navigate("http://...")
Once u got this proof of concept, u know what to do next
Back after a long hibernation.
-
July 3rd, 2003, 08:53 AM
#5
yeah, that works, but that is still for the html file
i dont want to do:
AxWebBrowser1.Navigate("http://www.google.com")
i want something with the concept
AxWebBrowser1.Source = "<html><title>My Page</title><body>Hello everyone!<br><br><b>BOLD</b></body></html>"
so that i dont have to use files
i suppose i could just create a temp file and dump the source i want to display into it, but that would be not very efficient
Man, I really want my name to be IPSteal, not ipsteal but i can't find out how to change it!!!
-
July 3rd, 2003, 03:21 PM
#6
You can still achieve your goal but at the expense of INTEROPing with COM/ActiveX components. Hopefully M$ will come up with .NET web browser component soon.
Any way, I tested this with a windows app project that included "Microsoft Web Browser Control (ShDocVw.dll)" from the TOOLBOX and "Micorosft HTML Object Library (MSHTML.TLB)" from the REFERENCES folder.
Once you drag the Web Browser control onto the form, add a button (by default Button1). Then add this code in:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim htmlDoc As mshtml.HTMLDocumentClass = DirectCast(AxWebBrowser1.Document, mshtml.HTMLDocumentClass)
With htmlDoc
.clear()
.body.innerHTML = "<b>This is a test</b>"
End With
End Sub
Good Luck,
-Cool Bizs
-
July 3rd, 2003, 06:09 PM
#7
most excellent!
2 points for you 
thanks again
ipsteal
Man, I really want my name to be IPSteal, not ipsteal but i can't find out how to change it!!!
-
December 1st, 2004, 09:11 PM
#8
Re: How to display HTML - based pages in VB ?
coolbiz or anyone....
Why do I get the err below for the code Sub Button2_Click:
An unhandled exception of type 'System.NullReferenceException' occurred in HTMLDirectCaster.exe
Additional information: Object reference not set to an instance of an object.
Thanks
Back after a long hibernation.
-
December 2nd, 2004, 04:22 AM
#9
Re: How to display HTML - based pages in VB ?
Nevermind... I got it.
It's because the page has a delay which causes the intiation to delay.
Regards
Back after a long hibernation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|