Solved

creating an HTML document inside the web browser control

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DO Loop not working 4 72
Macro which automatically sends attachment to Outlook 14 61
JSON Response and request in VB6 application 11 241
Using "ScreenUpdating" 6 55
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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

21 Experts available now in Live!

Get 1:1 Help Now