Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. currentElement.GetAttribute(VB.NET)

currentElement.GetAttribute(VB.NET)

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdatabasehelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Herboren
    wrote on last edited by
    #1

    I am trying to retrieve a value within a textbox that has a vlue already passed to it within a webpage. As you can see I am trying to extract the last name here(red fire truck:

    <span id="CallerForm1_CallerInformation1_lblLNameLabel" class="clsFormLabelSide" style="font-size:XX-Small;z-index: 109; left: 273px; position: absolute;
    top: 56px">(last)</span>
    <input name="CallerForm1:CallerInformation1:txtLName" type="text" value="RedFireTruck" maxlength="50" id="CallerForm1_CallerInformation1_txtLName" style="width:168px;z-index: 105; left: 266px; position: absolute;
    top: 72px" />

    What I have been using is the chunk within the methos: Document Completed. Im trying to store its value in a variable so I can pass the var to the next screen or a different page. All I could come up with was this. keep in mind I am using a msgbox to see if anything has been saved or retrieved by so far I havent gotten any notifications:

    Dim theElementCollection As HtmlElementCollection = wbCHCTrac.Document.GetElementsByTagName("input")
    If wbCHCTrac.Url.ToString.Contains("client/upd_caller.aspx?") Then
    For Each currentElement As HtmlElement In theElementCollection
    Dim controlName As String = currentElement.GetAttribute("id").ToString
    If controlName = "CallerForm1:CallerInformation1:txtLName" Then
    MsgBox(currentElement.GetAttribute("Value").ToString)

                End If
            Next
        End If
    

    Any help would be appreciated =)

    L 1 Reply Last reply
    0
    • H Herboren

      I am trying to retrieve a value within a textbox that has a vlue already passed to it within a webpage. As you can see I am trying to extract the last name here(red fire truck:

      <span id="CallerForm1_CallerInformation1_lblLNameLabel" class="clsFormLabelSide" style="font-size:XX-Small;z-index: 109; left: 273px; position: absolute;
      top: 56px">(last)</span>
      <input name="CallerForm1:CallerInformation1:txtLName" type="text" value="RedFireTruck" maxlength="50" id="CallerForm1_CallerInformation1_txtLName" style="width:168px;z-index: 105; left: 266px; position: absolute;
      top: 72px" />

      What I have been using is the chunk within the methos: Document Completed. Im trying to store its value in a variable so I can pass the var to the next screen or a different page. All I could come up with was this. keep in mind I am using a msgbox to see if anything has been saved or retrieved by so far I havent gotten any notifications:

      Dim theElementCollection As HtmlElementCollection = wbCHCTrac.Document.GetElementsByTagName("input")
      If wbCHCTrac.Url.ToString.Contains("client/upd_caller.aspx?") Then
      For Each currentElement As HtmlElement In theElementCollection
      Dim controlName As String = currentElement.GetAttribute("id").ToString
      If controlName = "CallerForm1:CallerInformation1:txtLName" Then
      MsgBox(currentElement.GetAttribute("Value").ToString)

                  End If
              Next
          End If
      

      Any help would be appreciated =)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I am probably stating the obvious, but I presume you have at some stage determined whether the DocumentCompleted handler is ven getting fired, and if so whether execution is ever going within the first If statement? And am I missing something.. your html has ...

      id="CallerForm1_CallerInformation1_txtLName"

      but then you're looking for an id ""CallerForm1:CallerInformation1:txtLName" (colon, not underscore)

                  Dim controlName As String = currentElement.GetAttribute("id").ToString
                  If controlName = "CallerForm1:CallerInformation1**:**txtLName" Then
      

      Shouldn't that be..

                  Dim controlName As String = currentElement.GetAttribute("id").ToString
                  If controlName = "CallerForm1\_CallerInformation1**\_**txtLName" Then
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups