Solved

creating an HTML document inside the web browser control

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

813 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

16 Experts available now in Live!

Get 1:1 Help Now