 |
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

August 15th, 2006, 02:06 AM
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Loading HTML into WebBrowser control
Can anyone tell me how I can write HTML to a WebBrowser control in
Visual Basic 6? I want to display HTML in the browser that is generated
from within my VB program.
|

August 15th, 2006, 12:08 PM
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
The first approach I would make is to write the HTML to a temp file, and point the browser control to that file.
|

August 16th, 2006, 01:32 AM
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by BrianWren
The first approach I would make is to write the HTML to a temp file, and point the browser control to that file.
|
Actually what am trying to achieve is this, I have a ListView control on my form and below it, I have a webbrowser control. The ListView control is populated by values from a recordset. I want a code that will be placed in the ListView click event, whereby, when one clicks on a selected item on the list, the details are shown in the webbrowser control like a web page (formated in HTML). I already have a HTML file but the challenge is how i can call values from the recordset to be displayed in the webbrowser control.
Thanks
|

August 16th, 2006, 12:03 PM
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
What kind of app is this? Is it a windows application? Web application?
If it is a Windows Application, do you have access to a folder that is exposed through a URL on an internet server?
|

August 17th, 2006, 02:17 AM
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is a windows application and I have a HTML template already saved in a folder. The issue is now calling the values from the database to fill in the values on the form.
|

August 17th, 2006, 10:20 AM
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
See, here's the thing: You can point a browser (or a browser control) to a URL (http:, etc), or you can point it to an IP address (149.206. . . .), or you can point it to a fileâif the running process has access to that file.
If you were using a server, and it had an internet server running on it, you could put your HTML in a file on that server, and hand the URL to the browser.
But, since you are using a Windows Application, you should be able to write an HTML file to the file system of the machine your application is running on, and then change the location of the browser control to that file. The contents of where you point it would be "C:\Program Files\My App\My Storage Location\tmp.htm" rather than "http: . . .tmp.htm".
But however the browser receives HTML, it will render it the same.
When you say that you "have a HTML template already saved in a folder," what exactly do you mean? That sounds like the terminology of a Visual Basic WebClass application... That is a horse of a different stripe altogether.
|

August 17th, 2006, 11:08 AM
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What I mean is, I have already laid out the form in HTML. To open the file in the webbrowser, am pointing to a form in a folder. What is remaining is filling in values from the database.
|

August 17th, 2006, 03:12 PM
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
This is more complicated. I don't know that you can actually do this.
If it were me, I wouldn't even try. I would overwrite the .htm file with freshly-generated HTML, in which the values of the controls exists in the actual file.
Once the HTML is on the way to the browser, your interaction is over.
You could add your own special tags/tokens to a file that largely has the HTML written, along with all the formatting. Then, when it is time to put up-to-date HTML into the browser, open that file for input while opening a different file for output. byte-by-byte read the input file. When you reach one of your tokens, send the data to the output file rather than sending input-file characters. Having sent the data, keep processing the input file and sending the characters to the output file.
When you're done, point the browser at the file you just created, and it will load having your data in it.
BTW, where abouts are you? Iâm in the Pacific NW, USA.
|
|
 |