Link to home
Start Free TrialLog in
Avatar of ztek
ztek

asked on

AxWebBrowser fill HTML

I am using AxWebBrowser  and need to find out how to feed it html.

like so  AxWebBrowser = " <html>" & _
"  <head>" & _
"   <title>" & _
"    Hello World Demonstration Document" & _
"   </title>" & _
"  </head>" & _
"  <body>" & _
"   <h1>" & _
"    Hello, World!" & _
"   </h1>" & _
" " & _
"   <p>" & _
"    This is a minimal "hello world" HTML document. It demonstrates the" & _
"    basic structure of an HTML file and anchors." & _
"   </p>" & _
"   <p>" & _
"    For more information, see the HTML Station at: <a href=" " & _
"    http://www.december.com/html/">http://www.december.com/html/</a>" & _
"   </p>" & _
"   <hr>" & _
"   <address>" & _
" " & _
"    &copy; <a href="http://www.december.com/john/">John December</a> (<a" & _
"    href="mailto:john@december.com">john@december.com</a>) / 2001-04-06" & _
"   </address>" & _
"  </body>" & _
" </html>"

and have it display correctly


Current Code:
        IECollection.Navigate2("about:blank")
        While Not IECollection.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
            Application.DoEvents()
        End While
        Dim oIETasks As mshtml.IHTMLDocument2 = DirectCast(IECollection.Document, mshtml.IHTMLDocument2)
        oIETasks.body.innerHTML = sHeader & sPage & sFooter
        Cursor.Current = Cursors.Arrow


Avatar of Erick37
Erick37
Flag of United States of America image

You can write directly to the document like this:


        With AxWebBrowser1
            .Navigate("about:blank")
            Do While .ReadyState <> SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
                Application.DoEvents()
            Loop
            .Document.open()
            .Document.write("<html>Hello</html>")
            .Document.close()
        End With
Avatar of ztek
ztek

ASKER

I have also done that. I have a javascript that changes the title of the page and i catch the event. But after the event is triggered once it will not trigger again. that is my problem.
Can you give an example of the code which you are actually using?
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ztek

ASKER

ok here is what i have

dim sHTML as string

shtml = "  <HTML> <HEAD> <meta name=vs_targetSchema content='http://schemas.microsoft.com/intellisense/ie5'> <style type='text/css'> body {       border: 0;       background: buttonface;       overflow: hidden;       margin: 0; }  .scrollTable {       border-left: 0px solid buttonshadow;       border-right: 0px solid buttonhighlight;       border-top: 0px solid buttonshadow;       border-bottom: 0px solid buttonhighlight;       background: window;        width: 100%;       overflow: hidden }  .scrollTableHead {       background: buttonface;       width: 100%;       overflow: hidden; }  .scrollTableHead table {       background: buttonface;       empty-cells: show;       table-layout: fixed; }  .scrollTableHead table td {       border-left: 1px solid buttonhighlight;       border-right: 1px solid buttonshadow;       border-top: 1px solid buttonhighlight;       border-bottom: 1px solid buttonshadow;  }  .scrollTableHead td, .scrollTableBody td {       color: windowtext;       font: icon;       padding: 2px; }  .scrollTableBody {       overflow: auto;       /* height needs to be calculated from scrollTable */       width: 100%; }   </style> <style> .thead TD {     BACKGROUND: #D4D0C8;     BORDER-BOTTOM: #000000 1px solid;     BORDER-LEFT: #ffffff 1px solid;     BORDER-RIGHT:  #000000 1px solid;     BORDER-TOP: #ffffff 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color:#000000; } .thead {     BACKGROUND: #D4D0C8;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px; } .tbody {     BACKGROUND: #ffffff;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px; } .tbodyICO {     BACKGROUND: #f5f5f5;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px; }  .tbodyLOA {     BACKGROUND: #9daac2;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : black; } .tbodySumm {     BACKGROUND: #D4D0C8;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : #800000; } .tbodyLate {     BACKGROUND: #e0e0e0;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : black; } A.Link {     COLOR: navy;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     CURSOR: hand;     TEXT-DECORATION: underline; } .tbodyMarkB {     BACKGROUND: #ffffe0;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : black; } .tbodyTotal {     BACKGROUND: #eeeeee;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : black; } .tbodyMidTotal {     BACKGROUND: #fffff0;     BORDER-BOTTOM: buttonshadow 1px solid;     BORDER-LEFT: buttonhighlight 1px solid;     BORDER-RIGHT: buttonshadow 1px solid;     BORDER-TOP: buttonhighlight 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;     color : black; } .Link {    COLOR: navy;    TEXT-DECORATION: underline;    CURSOR: hand; } </style> <style> .tbody1 {     BACKGROUND: #ffffff;     BORDER-BOTTOM: #eeeeee 1px solid;     BORDER-LEFT: #eeeeee 1px solid;     BORDER-RIGHT: #ffffff 1px solid;     BORDER-TOP: #ffffff 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;       cursor: default; } .tbody2 {     BACKGROUND: #FDF5E6;     BORDER-BOTTOM: #eeeeee 1px solid;     BORDER-LEFT: #eeeeee 1px solid;     BORDER-RIGHT: #FDF5E6 1px solid;     BORDER-TOP: #FDF5E6 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;       cursor: default; } .tbodySB {     BACKGROUND: #C1D2EE;     BORDER-BOTTOM: #316AC5 1px solid;     BORDER-LEFT: #C1D2EE 1px solid;     BORDER-RIGHT: #C1D2EE 1px solid;     BORDER-TOP: #316AC5 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;       cursor: default; } .tbodySL {     BACKGROUND: #C1D2EE;     BORDER-BOTTOM: #316AC5 1px solid;     BORDER-LEFT: #316AC5 1px solid;     BORDER-RIGHT: #C1D2EE 1px solid;     BORDER-TOP: #316AC5 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;       cursor: default; } .tbodySR {     BACKGROUND: #C1D2EE;     BORDER-BOTTOM: #316AC5 1px solid;     BORDER-LEFT: #C1D2EE 1px solid;     BORDER-RIGHT: #316AC5 1px solid;     BORDER-TOP: #316AC5 1px solid;     FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;     FONT-SIZE: 8pt;     HEIGHT: 16px;     PADDING-TOP: 0px;       cursor: default; } </style> <script language='javascript'> var SPID = 0; var SCL = ''; function SelectRow(PID,CCL,CustomerAcctNumber){       if (SPID!=0){             document.all('td1_' + SPID).className = SCL;             document.all('td2_' + SPID).className = SCL;             document.all('td3_' + SPID).className = SCL;             document.all('td4_' + SPID).className = SCL;             document.all('td5_' + SPID).className = SCL;             document.all('td6_' + SPID).className = SCL;             document.all('td7_' + SPID).className = SCL;             document.all('td8_' + SPID).className = SCL;             document.all('td9_' + SPID).className = SCL;       }       document.all('td1_' + PID).className = 'tbodySL';       document.all('td2_' + PID).className = 'tbodySB';       document.all('td3_' + PID).className = 'tbodySB';       document.all('td4_' + PID).className = 'tbodySB';       document.all('td5_' + PID).className = 'tbodySB';       document.all('td6_' + PID).className = 'tbodySB';       document.all('td7_' + PID).className = 'tbodySB';       document.all('td8_' + PID).className = 'tbodySB';       document.all('td9_' + PID).className = 'tbodySB';              if (SPID == PID){             parent.parent.document.title = CustomerAcctNumber       }       SPID = PID;       SCL = CCL; } </script> </HEAD> <BODY bgcolor='#D4D0C8' scroll='no' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'> <div class='scrollTable' id='testScrollTable'>       <span class='scrollTableHead'>             <table cellspacing='0' width='100%' cellpadding=0 id='Header'>                   <thead class=thead>                         <tr>                               <td align=center width='35'><nobr>#</nobr></td>                               <td align=center ><nobr>&nbsp;</nobr></td>                               <td align=center ><nobr>&nbsp;</nobr></td>                               <td align=left ><nobr>Account #</nobr></td>                               <td align=left ><nobr>Customer Name</nobr></td>                               <td align=left ><nobr>Rep.</nobr></td>                               <td align=left ><nobr>Submit Date</nobr></td>                               <td align=left ><nobr>&nbsp;</nobr></td>                               <td align=left ><nobr>Note</nobr></td>                         </tr>                   </thead>             </table>       </span>       <span class='scrollTableBody'>             <table cellspacing='0' width='100%' cellpadding=0>                   <tbody class=tbody>                      <tr id='4971'>                               <td id='td1_4971' class='tbody2' align=center nowrap width='35' onclick=SelectRow('4971','tbody2','Account_720697')>1</td>                               <td id='td2_4971' class='tbody2' align=center nowrap><IMG align=absMiddle alt='Status' border=0 height=16 src='\\pcsweb\d$\pcsprograms\boomboom\bin\WheelRed.gif' width=20  ></td>                               <td id='td3_4971' class='tbody2' align=center nowrap><IMG align=absMiddle alt='Priority' border=0 height=16 src='\\pcsweb\d$\pcsprograms\boomboom\bin\FlagGreen.gif' width=20 ></td>                               <td id='td4_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Account_720697')>720697</td>                               <td id='td5_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Account_720697')>MRS Mary Jones</td>                               <td id='td6_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Account_720697')>charmainek</td>                               <td id='td7_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Account_720697')>7/1/2005</td>                               <td id='td8_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Task_4971_720697')><IMG align=absMiddle alt='4971' border=0 height=16 src='\\pcsweb\d$\pcsprograms\boomboom\bin\Note.gif' width=20  onclick=SelectRow('4971','tbody2','Task_4971')></td>                               <td id='td9_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971','tbody2','Account_720697')>cust clld and went over her bill and it doesnt sho</td>                         </tr> </tbody>             </table>       </span></div> </BODY> </HTML> "
       

Cursor.Current = Cursors.AppStarting
        With IECollection
            .Navigate("about:blank")
            Do While .ReadyState <> SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
                Application.DoEvents()
            Loop
            .Document.open()
            .Document.write(sHTML)
            .Document.close()
        End With
        Cursor.Current = Cursors.Arrow

Avatar of ztek

ASKER

so after the title event gets triggered once it doesnt get triggered again