Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




WebBrowser Load And Parse XML Document


I am working on a VB6 project that needs to parse the HTML document so that I can interact with the data elements. If I use the normal HTML document.all collection, I see only a small fraction of the actual element tags that are actually on the displayed web page.

I am not sure how to identify for sure, but from some of my reading suspect it is an XML document. How do I tell for sure?

If this is true, I find sample code to lead me thru parsing the XML nodes, but I do not see how to load the XML document from my WebBrowser control. I have tried various Set XMLDoc=webbrowser.document variations.

Can anyone give me a clue on how to move forward?

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Parse/Load A Text Document
I recently asked this question, but never was given a complete answer, and im still a little slow on the whole idea of it.

Anyways, basicly I want to load a text document into a listview. An example entry would be:

Something1 : Something2

And then when it loaded, Something1 would be loaded as an Item in the listview, and then Something2 would be added as a SubItem for that Item. I know how to loop through a list view and everything, just parsing and adding it im not sure about it. Thanks in advanced

Parse XML Document
I need to parse an XML Document and for each node in the document, get a list of all available attributes that a node can have. Can someone help me out? Thanks, Jeremy

Knowledge is the most powerful tool a person can obtain.

DeveloperKB

Best Way To Parse A Txt Document? (SOLVED)
i have a txt document and i need to parse certain words out of it, specificly each word seperated by a space.

IE i need to be able to take this txt for example

12345 10000 cs 15000 p3 b5 c6 k2 cl

and put each groupe that is seperated by a space into its own variable

IE

JobNo = "12345"
Milage = "10000"
Payment = "cs"

etc

looking at somthing called split function, it works for just 2 words but not with a whole line. tried configureing some kind of for next loop with split but to no avail.

Any help would be great thanks.

FTP File - Parse - Load SQL Server?
What's the most efficient (ie, fastest processing) way to take a comma-delimited text file from an FTP site out on the Net, parse it into its individual fields and load it into a SQL Server table on the local website?

I need to set this up for an end-user who doesn't know how to transfer files, and doesn't know how to work in SQL Server itself.

We have a website, made up of ASP pages powered by Java Script and VB Script. We were thinking of letting the scripting languages do the work, but 4500 records were taking over 5 minutes! (Way too slow).

So, our next thought is a VB DLL, using ADO to load the tables, and being called from the ASP pages. But, never having written a DLL to be accessed by VB Script, I'm not sure how fast this will be.

Can someone suggest a fast, automated way to do this?

TIA.
Dave

How To Clear A Webbrowser Document Made With Document.write Commands
I'm using document.write to populate a Webbrowser object with HTML. How do I clear it so that the next Write command replaces what's already showing rather than adding to the end of what's already there? - Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments

How Can You Parse Html? (without Using A Webbrowser)
Anyone know??

For example, how can i loop through elements, etc when i just have HTMl stored in a string?

WebBrowser Control To Parse A Web Page
Hello
I know how to display an url using the webBrowser control but, how could i display only the content of a div avoiding or hiding ads and the rest of that page
Cheers
 

Parse HTML Table Via Webbrowser Control
Greetings,

The code list below parses all the table headers and then parses the table data. I would like to have the first header listed and then all the subsequent row data below for that header, then I would like to move to the next header and get all the subsequent row data below for that header and so forth.

Any ideas how I can integrate both loops together? Also, in this table is a download link represented by a hyperlink called "download". How can you replicate a click on that?

VB Code:
Private Sub timerPageLoad_Timer() Dim SelectElem As VariantDim opt As VariantDim i As Integer, j As Integer, v As Integer, x As IntegerDim GenFile As HTMLButtonElementDim DownFile As HTMLButtonElementStatic callCount As IntegerDim table As HTMLTableDim td As HTMLTableCellDim th As HTMLHeaderElementDim HeadElem As StringDim DataElem As String     On Error GoTo ErrHandler         For Each table In WebBrowser.Document.frames(1).Document.Forms(0).getElementsByTagName("tr")            For Each th In table.getElementsByTagName("th")                If th.innerText <> "" Then 'And th.innerText = "Report Name" Then                    HeadElem = th.innerText                    Debug.Print HeadElem                End If            Next        Next                For Each table In WebBrowser.Document.frames(1).Document.Forms(0).getElementsByTagName("tr")            For Each td In table.getElementsByTagName("td")                If td.innerText <> "" Then                    DataElem = td.innerHTML                    Debug.Print DataElem                End If            Next        Next         callCount = callCount + 1        timerPageLoad.Enabled = True        Exit Sub    End If CleanUp:    Exit SubErrHandler:    MsgBox Err.Description    Resume CleanUpEnd Sub

Load Word Document
I am working with VS 2005 and have microsoft office 2007 on vista.
When I open a word document from my .net application it works well.

But if the same application is run off another computer where I have xp and office 2003 I have the following error below because on that other computer the assembly for microsoft office has version 11 as opposed to 12 that's on the vista.

Is there a way to change the assembly version or make it backward-compatible when the exe file is created on .net

Thanks


Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

RTF Document Load/Unload
Hi there,

I would like to Unload my RTF Document if the Valid_Email is True. ??? But I'm not so sure about that if I use an ELSE or ELSE IF, and how I go from LoadFile to nothing.


VB Code:
If txt_AddressClient(8).Text = "" Then                Exit Sub            Else            Valid_HomeEmailClient = IsValidEmail(txt_AddressClient(8).Text)            If Valid_HomeEmailClient = False Then'--- If the variable is false Message the user to enter appropriate Email address.'                MsgBox "Please enter a valid Email address", vbInformation, "Error"'--- Loading a Word file showing on E-mail information.    rtf_ClientInfo.LoadFile App.Path & "DocumentsEmailInfo.rtf", rtfRTF'--- Set focus back to control.                txt_AddressClient(8).SetFocus            End If            End If


Any Ideas.

Thanks aktell

Help With Program To Load Up A MS Word Document In VB
Hey, I am making a program where I have made a list of all my geometry theorems in MS Word I was wondering how I would get it to load up in my program. I will also have a search bar where I can search for what theorem I want and it will bring everything like that up. I was wondering if anyone could help me on the code. Any advise would be greatly appreciated.

Error Code With Load XML Document
Hi People,
i have a problem with the load XML Document
Here is the code :
**************************

Code:
If oXMLDoc.Load(strHTTP) Then
Set NodeList = oXMLDoc.getElementsByTagName("root")
For Each Element In NodeList
MsgBox oXMLDoc.documentElement.xml
If (Element.getAttribute("TRX_ERROR")) <> "" Then
LOGON = StringDeError(Element.getAttribute("TRX_ERROR"))
WriteErrorLog LOGON, strHTTP
Exit Function
End If
Next
Else
If (oXMLDoc.parseError.errorCode <> 0) Then
Dim myErr0
Set myErr0 = oXMLDoc.parseError
LOGON = GetSysIni("Errores", "Error1", App.path & "MsgErrores.ini")
WriteErrorLog LOGON, strHTTP
End If
**********************************
the errorCode : -1072896682
the reason : "Invalid at the top level of the document.
the readyState : 4
the srcText : "<root COD_PERFIL="5" CUIT="***********" ESTADO="A" OPERATION_ID="LOGON" PROVEEDOR="98765" RAZON_SOC_PROV="********************" REQUIREMENT_ID="LOGON_KIOSCO" USER_ID="KIOSCO"></root" IS OK
the url : "http://...." IS OK


Somebody can help me ? Any idea ?

thanks in advance

Load Document In Previous Instance
Hey,

I have been looking for some code to help me.

Basically I am making an editor. When the editor opens up, I want it too check for command line parameters (eg. Myproject.exe C:
eadme.txt), if there is any, then check for App.Previnstance. If there is already one open, then I want to load it in the previous instance, in a new child MDI form and then close the new instance.

If anyone has any code to help me out, I would really appreciate it

Thanks in advance,
Mark

WebBrowser.Document
I wanna ask, where can I find the most complete information about properties, events and method following after WebBrowser.Document? For example, WebBrowser.Document.Links, WebBrowser.Document.Body, WebBrowser.Document.All.Code, WebBrowser.Document.Forms. All these is what I see on different forums, but I don't understand meaning most of them. First of all I have to know what methods, properties and events are there in general and examples of their usage. I was looking for it some time over the internet but still haven't found anything that I exactly need.
Would be very thankfull for any help

How To Use Webbrowser.document
<INPUT TYPE="TEXT" NAME="oc_input" SIZE=30 MAXLENGTH=300>

Hi, when i visit a website using a webbrowser control i want to setfocus to fill in the INPUT TYPE field but the site also has three frames.

can i do this with the webbrowser.document object model, and can somebody show me how.

WebBrowser.Document Help
Value not changing on screen untill program ends or at a break(while debugging) What can I do to make change show when value is entered by program?

I am using a loop to go through numbers.


WebBrowser.Document.All.code.Value = Text2.Text

Webbrowser.document
**<form name="accept" method="GET" action="">
**<input type="hidden" name="us">
**<input type="hidden" name="_lang">
**<input type="hidden" name="beta">
**<input type="hidden" name="SID" value="1013818981">
**<input type="hidden" name="ac" value="">
**<input type="hidden" name="rus" value="lw9fd.law9.hotmail.msn.com">
**<input type="hidden" name="curmbox" value="F000000001">
**<input type="hidden" name="tos" value=1>
**<font class="f" size="4">
**<input type="submit" class="Bsbttn" value=" I Accept ">

'this is what the source looks like and thers an except and decline buttons on it... how would i submit the accept buton?
using ( .forms(0).elements("").value = "")

WebBrowser.Document
Saying:

"Set objItems = HTMLDoc1.getElementsByTagName"
gives a "Argument not optional" error and same goes for saying :

"Set objItems = HTMLDoc1.getElementsByTagName()", you must have some sort of tag name like

"Set objItems = HTMLDoc1.getElementsByTagName("img")", then it gets all the "img" elements, but I want a way to get ALL the elements, thanks,

WebBrowser.Document &lt;--Some Help Please
Thanx for all your help before. But I still have on small problem! I can input HTML into the webbrowser by using WB.Document.Write but how do I clear The current page from the webbrowser??

Load ActiveX Document Dll Or Form In A Frame?
Maybe I've missed something, but I haven't found it.

How do you load an ActiveX document dll or another form into a frame by pressing a button?

Thanks

Passing Document Argument To Form Load Sub
Hi everyone!

I have the following sub in a class module, and i want to pass the DocumentObject argument to a form load sub, How can i do this?
thanks.

*******Class module ****************

Private Sub MyAppEV_OnCloseDocument( _
ByVal DocumentObject As Document, _
ByVal FullFileName As String, _
ByVal BeforeOrAfter As EventTimingEnum, _
ByVal Context As NameValueMap, _
ByRef HandlingCode As HandlingCodeEnum _
)


Msgbox "the document name is "&DocumentObject

End Sub

Using InnerHTML In VB 6 (Load Html-document Into Iframe)
I have one html-document that looks like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="CSS/base.css" type="text/css">
<script type="text/javascript" language="javascript" src="Javascript/base.js"></script>

</head>

<body onLoad="javascript:init()">

<div id="globalcontainer">

<div id="header">
<ul>
<li id="current"><a href="#" onClick="activateTab(this.parentNode, 'home')">Home</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'channels')">Channels</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'diagnosis')">Diagnosis and treatment</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'glossary')">Glossary</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'needling')">Needling</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'pointCat')">Point categorie</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'pointindex')">Point index</a></li>
<!--<li><a href="#" onClick="activateTab(this.parentNode, 'methods')">Point selection methods</a></li>-->
</ul>
</div>
<br style="clear:left"/>
<span class="style1"></span>

<div id="box">
<iframe name="menu" id="meny" width="595" height="100" src="Menu/mHome.htm" frameborder="0"></iframe>
</div >

<div id="view">
<iframe name="show" id="show" src="data/home.htm" width="595" height="475"></iframe>
</div>

</div>
</body>
</html>

And i want to load another html-document in the iframe with name="menu" from a webbrowser made in VB 6 with webbrowser control. The html-document have I read in from a file in to a string "s" I tried with this but i doesn´t work.



Code:Set mDoc = WebBrowser1.Document

Code:mDoc.frames(0).innerHTML = s

Could anyone help me?

Here are all the code i try

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, _
Headers As Variant, Cancel As Boolean)

Dim Ev As String
Dim txtStream As TextStream
Dim strElement As String
Dim i As Integer


Set mDoc = WebBrowser1.Document



If UCase$(Left$(URL, 6)) = "EVENT:" Then
'this is our event, process it and cancel navigation
Ev = UCase$(Mid$(URL, 7))

Call MsgBox(Ev)
Select Case Ev
Case "HELLO"
MsgBox "Hello from VB App"
'set a field on HTML page
WebBrowser1.Document.All("field1").Value = _
"Hello from VB"

Case "CLOSE"
If MsgBox("Are you sure you want to exit?", _
vbYesNo) = vbYes Then
End
End If

Case "CHANNELS"

Set txtStream = mFso.GetFile("C:AkupunktörAkupunktör_klientSourceMenumChannels.htm").OpenAsTextStream(ForReadin g)
s = txtStream.ReadAll

Dim frames As HTMLElementCollection
Dim frame As HTMLIFrame

'Set frames = mDoc.getElementsByTagName("iframe")

'WebBrowser1.Document.getElementById ("box")
'For Each frame In frames
' If frame.name = "box" Then
'Set getMainWindow = frame
'Exit For
' Call MsgBox("Hej")
'End If
'Next


Dim strOuter As String
Dim o, oFrame As Object
Set o = mDoc.frames


For i = 0 To o.length - 1
' Debug.Print "Frame:" & i & o(i).name
Set oFrame = o(i)
' Debug.Print "Frame:" & i & oFrame.name

Next i
mDoc.frames(0).innerHTML = s




'Call MsgBox(mIframe)



End Select
Cancel = True
End If
End Sub

Using InnerHTML In VB 6 (Load Html-document Into Iframe)
I have one html-document that looks like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="CSS/base.css" type="text/css">
<script type="text/javascript" language="javascript" src="Javascript/base.js"></script>

</head>

<body onLoad="javascript:init()">

<div id="globalcontainer">
    
    <div id="header">
        <ul>
            <li id="current"><a href="#" onClick="activateTab(this.parentNode, 'home')">Home</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'channels')">Channels</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'diagnosis')">Diagnosis and treatment</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'glossary')">Glossary</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'needling')">Needling</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'pointCat')">Point categorie</a></li>
            <li><a href="#" onClick="activateTab(this.parentNode, 'pointindex')">Point index</a></li>
            <!--<li><a href="#" onClick="activateTab(this.parentNode, 'methods')">Point selection methods</a></li>-->
        </ul>
    </div>
    <br style="clear:left"/>
    <span class="style1"></span>
    
    <div id="box">
            <iframe name="menu" id="meny" width="595" height="100" src="Menu/mHome.htm" frameborder="0"></iframe>
    </div >
  
    <div id="view">
        <iframe name="show" id="show" src="data/home.htm" width="595" height="475"></iframe>
      </div>
    
</div>
</body>
</html>

And i want to load another html-document in the iframe with name="menu" from a webbrowser made in VB 6 with webbrowser control. The html-document have I read in from a file in to a string "s" I tried with this but i doesn´t work.
    

Code:Set mDoc = WebBrowser1.Document
Code: mDoc.frames(0).innerHTML = s

Could anyone help me?

Here are all the code i try

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, _
           Headers As Variant, Cancel As Boolean)

        Dim Ev As String
        Dim txtStream As TextStream
        Dim strElement As String
        Dim i As Integer
        
        
        Set mDoc = WebBrowser1.Document
        
        
        
          If UCase$(Left$(URL, 6)) = "EVENT:" Then
              'this is our event, process it and cancel navigation
              Ev = UCase$(Mid$(URL, 7))
              
              Call MsgBox(Ev)
              Select Case Ev
                  Case "HELLO"
                      MsgBox "Hello from VB App"
                      'set a field on HTML page
                      WebBrowser1.Document.All("field1").Value = _
                          "Hello from VB"

                  Case "CLOSE"
                      If MsgBox("Are you sure you want to exit?", _
                  vbYesNo) = vbYes Then
                          End
                      End If
                      
                Case "CHANNELS"
                
                    Set txtStream = mFso.GetFile("C:AkupunktörAkupunktör_klientSourceMenumChannels.htm").OpenAsTextStream(ForReading)
                    s = txtStream.ReadAll
                    
                    Dim frames As HTMLElementCollection
                    Dim frame As HTMLIFrame
     
                    'Set frames = mDoc.getElementsByTagName("iframe")
                    
                    'WebBrowser1.Document.getElementById ("box")
                     'For Each frame In frames
                       ' If frame.name = "box" Then
                            'Set getMainWindow = frame
                            'Exit For
                         ' Call MsgBox("Hej")
                        'End If
                        'Next
               
                
                    Dim strOuter As String
                    Dim o, oFrame As Object
                    Set o = mDoc.frames
    
    
                    For i = 0 To o.length - 1
                        ' Debug.Print "Frame:" & i & o(i).name
                        Set oFrame = o(i)
                        ' Debug.Print "Frame:" & i & oFrame.name
                    
                    Next i
                    mDoc.frames(0).innerHTML = s

  
     
                    
                    'Call MsgBox(mIframe)
                    
                  
                  
              End Select
              Cancel = True
          End If
      End Sub

Webbrowser.Document Collection
i get data from a html form with the code below:
WebBrowser1.Document.All.Item("text1").Value

in vb editor i can't see all the members of Webbrowser.Document collection.

anybody lead me to have complete referans of Webbrowser.Document
collection?

Webbrowser Document Available Collection
hi ..
iam trying to retrive the :
1)type of the image using webbrowser control
2)size of a file over the internet ...

until now i have :

Code:
imagesize=webbrowser1.document.images(x).filesize 'Working great
imagetype=webbrowser1.document.images(x).mimetype (or type) ' not working ...

filesizeoverinternet=webbrowser1.document.links(y).filesize 'not working
filetypeoverinternet=webbrowser1.document.links(y).type 'not working

can anyone please tell me what iam doing wrong ?
and how can i get the filesize without having to download the file ?
thanks in advance

Webbrowser Document Lagging
i am building a telnet client with webbrowser component
the problem is when the buffer get bigger, it lags out
i like mud and trying to make a client for it
i am converting the ansi characters from mud for <font color> etc...
but it lags a lot when overflowing the buffer
i can send my source if anyone wants to help me with this
i don't know what to do to stop the lagging heh

please
i am newb

darkneo@terra.com.br

Webbrowser And .Document.innerHTML
Hello everybody, Im new to the VBforums, Its an very long time since i'm using Visual Basic 6 agian for an small project (normally i'd have used another programming platform but this is an tiny project), I've HAD an lot of experience but since the new C++ edition, Im lazy to code because C++ areally shows an lot of solutions in the IDE.

Well, My qeustion is. The webbrowser navigates to an URL where it has the follow text in the screen somewhere in the page once loaded:


Code:
Welcome <a href="select.php" style="color: #FFCC66;" target="_new">Do it</a>!


Now im know from the early days back that you could change that complete Html line with your own line.

I want to delete the whole <a href thing and replace welcome with hello; My example code i've made is:


Code:
Private Sub Browser_StatusTextChange(ByVal Text As String)
Browser.Document.body.innerHTML = Replace(Browser.Document.body.innerHTML, "_LINKALERT", "<i><a href=" & Chr(34) & "javascript:alert('" & Text1.Text & "')" & Chr(34) & ">" & Text1.Text & "</a>")
End Sub


This code does not work, Could anybody help me out solving this. Thanks

WebBrowser.document Error (438)
Can someone tell me what is wrong with the below code? It runs fine on XP PRO, but I get a runtime error 438 "Object doesn't support this property or method" when run on WIN98. Here is a snipet of code were I seem to be getting the error.

Thanks


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

If URL <> vbNullString And URL <> "http:///" Then
If Mid$(URL, InStr(1, URL, "?") + 1) = "SignIn" And blnShutDown = False Then

****HERE is were the break begins:

WebBrowser1.Document.All.nameditem("userid").Value = Text1.Text

WebBrowser Document Properties
Hi,

I'm looking for information about WebBrowser.document properties (such as .documentElement, .All.Item().name, etc).
Has anyone has a link ?

Thx

Webbrowser Help Webbrowser1.document HELP!!
I know there are more commands after webbrowser1.document but i only know that inerhtml one. Does anyone know the rest or where i can find the rest AT ?

WebBrowser - Scrolling To End Of The Document :)
Hello ! I Use WebBrowser control to create a simple chat program...
i add lines to htmldocument

Code:
   Dim doc As HTMLDocument
   Set doc = WebBrowser.Document
   doc.body.innerHTML = doc.body.innerHTML & "<H7>blablabla..</H7>"


..and i want to scroll to the end of it..
the way of scrolling down is as primitive as can possibly be !!
please help me with this! I need 'a right' way not 'a round' way ;)

Code:
   'this primitive scroll
   WebBrowser.SetFocus
   SendKeys "{end}"


SylwekS

How Do You Get Webbrowser To Load A Java App?
I navigate the webbrowser manually to runescape.com go to play the game and the java app doesnt come up. Do you know how to fix this? Thanks

After I Load A Webbrowser How Do I Unload It
i am working on this small app an d after i load a webbrowse like:
wb() is a webbrowser
newBrowser is a intenger

Load WB(newBrowser)
WB(newBrowser).Visible = True
WB(newBrowser).Move WB(1).Left, WB(1).Top, WB(1).Width, WB(1).Height

how can i unload it

Webbrowser.Document.body.InnerHTML
Hi

I dunno if this has been posted before cause the search says the words are to short

I have written a mail client which is fully functional except when it comes to displaying html mails, now i wrote a function to convert the html part of the mail to MHT format if i write this info to a file and open it in IE then it works exactly as i want it to, thing is i dont wanna write every mail to a file so i tried using Webbrowser.Document.body.InnerHTML = sMHTSource the problem then occurs that the control strips out all the vbCRLF's making the MHT source invalid.... can anyone help with this?

Viewing Source Of Document In Webbrowser
Hello, i need to be able to look at text in a document loaded by the webbrowser control. the document is html, and i want to look at its source. the value i am looking for is not in a form control.

How Can You Access The 'document' Of A Frame In A Webbrowser?
anyone know?
wb.document.documentelement.innerhtml = html of the top page in a webbrowser, but how can i get the html of a frame in a webbrowser?

Webbrowser Document Submit Help Needed
I'm using the Webbrowser control how do I submit the button below? If thats not possible can i just send a click command to the subject field like Webbrowser.Document.All.('subject').Value.Click (thats probably not right) something like that?
<vbcode>
<BUTTON
onclick="var f = this.form; f.notes_compose_form_submit.value = 'send';if (f.request_submitted) { return false; } this.innerHTML = '<span><em>Please wait...</em></span>'; this.disabled = true; f.request_submitted = true; setTimeout(function() { if (!f.onsubmit || f.onsubmit()) { f.submit() } }, 150); return false;"
type=submit>Send</BUTTON>
</vbcode>

Filling Textboxes In Webbrowser Document
Hey. I need to fill textbox, which is protected or something..
Textbox's code is like this:

HTML Code:
<INPUT TYPE=hidden NAME=a0f2a0707462ad79826e98a1ce5721ad2 VALUE=951b01a2af33d0779983>

Can i fill text boxes in some kind of other way?
Because using
VB Code:
Wb.Document.All("a0f2a0707462ad79826e98a1ce5721ad2").Value = "lol"

Is not useful, because the textboxes name is different every time..
More of this code:

HTML Code:
<FORM ACTION=http://www.rate.ee/userinfo.php METHOD=post onSubmit="post.disabled=true;">
pealkiri: <INPUT CLASS=in1 TYPE=text NAME=subject SIZE=30 MAXLENGTH=60><BR><BR>
<TEXTAREA CLASS=in1 ROWS=10 COLS=60 NAME=text></TEXTAREA><BR><BR>
<INPUT TYPE=hidden NAME=act VALUE=contact>
<INPUT TYPE=hidden NAME=id VALUE=202005>

<INPUT TYPE=hidden NAME=a0f2a0707462ad79826e98a1ce5721ad2 VALUE=951b01a2af33d0779983>
<INPUT CLASS=in1 onMouseOver="this.classNAME='in2';" onMouseOut="this.classNAME='in1'" TYPE=submit NAME=post VALUE="Saadan!">
</FORM>
<BR></td>
<TD WIDTH=4 CLASS=moduleContentText><IMG SRC=http://pics.rate.ee/pics/empty.gif WIDTH=1 HEIGHT=1></TD>
<td width=1 valign=top class=backFrame><img src=http://pics.rate.ee/pics/empty.gif width=1 height=1></td>
</tr>
</table>

Set Radio Button Via WebBrowser.Document
Greetings,

I have written code which logs into an .asp page successfully. After invoking the submit button I'm taken to a page which has a set uf radio buttons. I have not been able to gain control of the desired radio button. I thought this would work:


Code:
WebBrowser.Document.AdminForm.SurveyList.Value = 3114


Using the DOMi feature from Firefox, I found that the value of the desired radio button I want is 3114.

In the page source is:
m_lSurveyID = document.AdminForm.SurveyList[SelectedItem].value;

Determine If WebBrowser Document Has Expired
Is there any event that is fired if the webpage in a certain webbrowser has expired (changes has already been made to the page) or any property to determine it?

Webbrowser.Document Focus On Textfield...
Anyone know offhand how to set focus to a textfield? I know how to add the text, but I also need focus in the text box and not just the entire webbrowser control.




Thanks..

WebBrowser Document Obj - Populating Text
I am trying to create a app that first signs in and then I can manually navigate. The issue I am having is that it's a .jsp page and I can fill the username & password textboxes (but manually have to hit submit) but when the second page refreshes my DocumentComplete fires again and this time no form elements are found so it errors. How do I recognize if the form element is on a page before I enter information?




VB Code:
Private Sub Form_Load()    WebBrowser1.Navigate ("https://ecap21.usps.com/cgi-bin/ecapbv/scripts/login.jsp?app=GSS&appURL=https://sss-web.usps.com/ds/jsps/ds_labelInfo.jsp")End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) '========================================================= '   '========================================================= Dim sURL As String  sURL = URL txtUrl.Text = sURL  If sURL = "https://ecap21.usps.com/cgi-bin/ecapbv/scripts/login.jsp?app=GSS&appURL=https://sss-web.usps.com/ds/jsps/ds_labelInfo.jsp" Then    With WebBrowser1.Document.All        .Item("username").Value = "username"        .Item("password").Value = "password"       '.Item("Sign In").Click     End WithEnd If End Sub


You can see to populate the text you do:
.Item("username").Value = "username"

To click the submit button you do:
.Item("buttonname").Click

If an item doesn't have a name how do you click it?
Example, the signin button is the following html code:

Code:
<INPUT TYPE='image' SRC='/images/btn_signin.gif' BORDER='0' ALT="Sign In" tabindex='5'>


Thanks in advance for any wise advice.

Stream From WebBrowser Control Document...
Ok, a few days ago I posted on this forum for a way to return the HTML source from a WebBrowser control in VB.NET. The solution was...

Add before the "Public Class Form1"


Quote:





Imports System.Text
Imports System.Runtime.InteropServices

<ComVisible(True), ComImport(), Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> Public Interface IPersistStreamInit
Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()> Function IsDirty() As Integer
<PreserveSig()> Function Load(ByVal pstm As UCOMIStream) As Integer
<PreserveSig()> Function Save(ByVal pstm As UCOMIStream, ByVal fClearDirty As Boolean) As Integer
<PreserveSig()> Function GetSizeMax(<InAttribute(), Out(), MarshalAs(UnmanagedType.U8)> ByRef pcbSize As Long) As Integer
<PreserveSig()> Function InitNew() As Integer
End Interface





Add in the Global Area - not really sure what its called.


Quote:





<DllImport("OLE32.DLL")> Public Shared Sub CreateStreamOnHGlobal(ByVal hGlobal As IntPtr, ByVal fDelete As Boolean, ByRef stm As UCOMIStream)
End Sub
<DllImport("OLE32.DLL")> Public Shared Sub GetHGlobalFromStream(ByVal stm As UCOMIStream, ByRef hGlobal As IntPtr)
End Sub

Private HTML_SOURCE As String





Finnally add this to the function/sub to return the HTML source...


Quote:





Dim ips As IPersistStreamInit
Dim iptr As New IntPtr()
Dim strm As UCOMIStream
Dim vPostData As String

HTML_SOURCE = ""

iptr = Marshal.AllocHGlobal(50000)
CreateStreamOnHGlobal(iptr, True, strm)

ips = DirectCast(Browser1.Document, IPersistStreamInit)
ips.Save(strm, False)
GetHGlobalFromStream(strm, iptr)

HTML_SOURCE = Marshal.PtrToStringAnsi(iptr)
HTML_SOURCE = HTML_SOURCE.Replace(Chr(13), "")
HTML_SOURCE = HTML_SOURCE.Replace(Chr(10), Chr(13) & Chr(10))





Now this does seem to work, on the odd occasion, but then again it sometimes doesent return the whole HTML source - ie a bit missing.

Ive had it where it repeats itself, eg...


Quote:





<!-- END -->


</body>
</html>

-->


</body>
</html>





Also mystery characters have appeared...


Quote:





Error
<!-- END -->


</body>
</html>

0






Quote:





Source
<!-- END -->


</body>
</html>








Does anyone know why this happens (I think its because the buffer isnt being properly empties / populated) or know of a solution?

WebBrowser.Document.write ERROR
when i use WebBorowser.Document.write i get an error "obeject variable or withblock variable not set" i think u have to put WebBrowser.document.open or something like that can u help me

Activex Document Runs In WebBrowser
I am using an Active X document Dll(Form).Can I Change the the Icon(Presently It is VBD ICON) at run time.I was able to change titlle and menu etc with Win API calls.So please advice me how to chnage the ICOn? Can I do it with API ? If so Which declaration I can use?Or Any other method? Also Can I use this browser as a container for other documents.So that It will run in the Browser like an MDI form treats the child forms.I highly Appreciate your response and help.Please give first Priority for ICON

With thanks
Anil

Webbrowser Control For Word Document
I have a program that contains a webbrowser control to display my powerpoint or word files. I load the files to be displayed after being selected this way:
webbrowser1.navigate "C: empxyz.doc"

However, there are some Word files that I do not want all users to be able to view. These files are password protected. I use the GetUserName function to check on the user id before proceeding.
How can I use the code above to open these files without the password prompt? I intend to put the password in my code so that users do not know of the password. Please let me know how to inform Word of the password through the webbrowser control.
Thank you.

Printing An .htm Document Using The WebBrowser Control
The code below used to work but is now throwing the following error:
'Trying to revoke a drop target that has not been registered'.

//Code Start
WebBrowser1.Navigate strFilePath
   ' stall logic here to allow browser to navigate to
   ' file (strfilepath is the location of the file)
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
   ' this is where the error is thrown.
// Code End

Value of OLECMDID_PRINT is 6
Value of OLECMDEXECOPT_DONTPROMPTUSER is 2

Anoter site suggested to try the following code:

// Code Start
Do While WebBrowser1.QueryStatusWB(OLECMDID_PRINT) <> OLECMDF_SUPPORTED + OLECMDF_ENABLED
     DoEvents              
Loop
// Code End

The problem is that OLECMDID_Print will never equal
(OLECMDF_SUPPORTED + OLECMDF_ENABLED).
They are all constant values. 6 will never equal 1 + 2

Thanks in advance for any help.

Regards,
Keith



Problem With Document From WebBrowser Control
I am at my wits' end.

I have the following code:

WebBrowser1.Navigate ("c:pathpage.htm")
Text1.Text = WebBrowser1.Document.Links.length

Where the page.htm has the following HTML:

<html>
<head><title></title></head>
<body>
<h1>Test</h1>
<a href="somepage.htm">Link</a><br>
<a href="anotherpage.htm">Second Link</a><br>
<a href="andonemore.htm">Third Link</a><br>
Test
</body>
</html>

Page loads into browser control fine, but the value that appears in
the TextBox control is "0". This is the same value I get when I query
any of the collections in the Document object. I cannot figure out
what magic I need to perform to be able to analyze the document object
that is current loaded in the WebBrowser control. Any help you guys
could give me would be greatly appreciated.

Further info:

VB6
WinXP

TIA

Mark

Determine If WebBrowser Document Has Expired
Is there any event that is fired if the webpage in a certain webbrowser has expired (changes has already been made to the page) or any property to determine it?

Copyright © 2005-08 www.BigResource.com, All rights reserved