Results 1 to 5 of 5

Thread: Please Help With Code: Web Based

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2012
    Posts
    75

    Exclamation Please Help With Code: Web Based

    I Am Having Issues Finding A Method To Get The System.String Results To the cnine variable below.

    System.String is System.__ComObject.ToString

    This is the Code:

    Code:
            Dim CodeElementsy As HtmlElementCollection = Form1.WebBrowser1.Document.GetElementsByTagName(txttgname.Text)
            For Each codeElementy As HtmlElement In CodeElementsy
                    If codeElementy.GetAttribute("style").GetType.ToString <> "" Then
                        Dim cnine = codeElementy.GetAttribute("style").GetType.ToString
                        If cnine = "System.String" Then
                            'Get The System Com Event As Text
                            txtssbox.Text += "Style: " + cnine + vbCrLf
                        End If
                    End If
    When cnine is displayed, is shows System.String as the Result in the TextBox of txtssbox.Text, but, I want it to display the value of the system.string(system.__comobject) as a string result.

    What lines of the code above can I rewrite to do the above??,.. I would really appreciate it. Thanks
    Last edited by VBbbq; Jul 15th, 2012 at 08:26 PM.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Please Help With Code: Web Based

    What's the url? Kinda difficult to help parsing an element without knowing what the element actually is!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2012
    Posts
    75

    Re: Please Help With Code: Web Based

    www.google.com - testing site.

    When I retrieve the style attribute of htmlelements, gb_1, etc. it comes back as system.string with the above code. The style of gb_1 is css/text, i think... div id tags.

    I've tried different methods and have gotten: system.string, system.object, [object] and others...

    What I would like the code to return for gb_1 is its actual value, or atleast not say system.__comobject

    gb_1 information:

    View Source:
    Code:
    <div id=gbw><div id=gbzw><div id=gbz><span class=gbtcb></span><ol id=gbzc class=gbtc>
    <li class=gbt><a onclick=gbar.logger.il(1,{t:119}); class=gbzt id=gb_119 
    href="https://plus.google.com/?gpsrc=ogpy0&tab=wX"><span class=gbtb2></span><span class=gbts>
    +You</span></a></li><li class=gbt><a onclick=gbar.logger.il(1,{t:1}); class="gbzt gbz0l gbp1" 
    id=gb_1 href="http://www.google.com/webhp?hl=en&tab=ww">
    <span class=gbtb2></span><span class=gbts>Search</span></a></li>
    Last edited by VBbbq; Jul 14th, 2012 at 07:13 PM.

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Please Help With Code: Web Based

    I think what you're looking for is ...

    Dim cnine = codeElementy.OuterHtml

    or possibly

    Dim cnine = codeElementy.InnerHtml

    You may need to do some further parsing to get exactly what you want.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2012
    Posts
    75

    Re: Please Help With Code: Web Based

    Cool, it worked. Thanks!

    Dim cnine = codeElementy.OuterHtml().ToString

    Just Need To Add/Remove The Strings Like You Said.
    Last edited by VBbbq; Jul 15th, 2012 at 08:24 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width