Solved

creating an HTML document inside the web browser control

Posted on 2000-04-25
5
255 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 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