Solved

creating an HTML document inside the web browser control

Posted on 2000-04-25
5
251 Views
Last Modified: 2013-12-26
I am creating an html document inside a web browser control, as shown in the msdn article "Handling Events in Visual Basic Applications"

The point in the example where they create a document is like this
---------------------------------------
'Create an HTML document inside the WebBrowser control
    Dim sHTML
    sHTML = "<P>This is some text.</P>"
    sHTML = sHTML & "<P>And here is a button.</P>"
    sHTML = sHTML & "<BUTTON ID=btnMyButton>"
    sHTML = sHTML & "Click this button.</BUTTON>"
 
    wbMyBrowser.Document.body.innerHTML = sHTML  
 
'Instantiate new member of class
    Set cfForward = New clsForward  
    cfForward.Set_Destination Me, "Some_Procedure"
    Set wbMyBrowser.Document.All("btnMyButton").onclick = cfForward

End Sub
------------------------------------


What I CAN'T find is how to create the header portion of my html document, where I can put a couple VBScript functions that I need to process the information entered into my web page.

I am looking at the WebBrowser Object and Document Object in msdn, and see no reference to the html header.

I'm sure it's there, I just don't see it %)

thanks in advance

Jim
0
Comment
Question by:jnearing
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 2751696
is there not a head property under wbMyBrowser.Document?

M
0
 
LVL 1

Author Comment

by:jnearing
ID: 2751705
I'm looking the documentation now for the WebBrowser object and the document.

There's nothing that shows a header object or property.

Maybe there is some other functionality to adding a VBScript function to a web page.   I might be approaching it the wrong way.

thanks

Jim

0
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 total points
ID: 2751742
Usually I *CHEAT* and just write the HTML to disk and then point the browser control to that file. It's a little slower (but not much) and I get complete control without having to fiddle with poorly documented features.

M
0
 
LVL 1

Author Comment

by:jnearing
ID: 2751802

I initially did it that way, and had it all working, as long as I had a break point in the code after writing the file to disk.

I create an instance of a class with a method that detects when the button on the html form is clicked.

I find that without the breakpoint after the html file is written to disk, the method doesn't fire, or an object that is to be created isn't there.

I'm thinking it must be a timing issue of having the disk file created.

Creating the page in memory should be faster and cleaner.

I may have to put a wait in there to allow an html file on disk to be created before the other stuff happens.

I am more of a C programmer than VB, so I am floundering a little with this.

thanks
0
 
LVL 1

Author Comment

by:jnearing
ID: 2752323
I went back to writing the file out to disk each time.

Found a property of the WebBrowser control called readystate that I can test, and wait until it returns ready.

Then it successfully create the instance of the class and goes on.

thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now