Results 1 to 5 of 5

Thread: [RESOLVED] Entering text in a textbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    76

    Resolved [RESOLVED] Entering text in a textbox

    How can i enter text in a textbox present in a webpage from another trextbox named text4 in my form ?

    The source code of the text box in the webpage is:

    Code:
    <p class="center"><input type="text" name="Validate" size="6" maxlength="6" /><br />
    Last edited by DragonBoy; Sep 15th, 2009 at 07:59 AM.

  2. #2
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Re: Entering text in a textbox


  3. #3
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Re: Entering text in a textbox

    Try this:

    vb Code:
    1. Option Explicit
    2.  
    3. Private Function getBonusFormTextBoxValue() As String
    4.     Dim oHTMLDoc As HTMLDocument, oEle As IHTMLElement, oForm As IHTMLFormElement, szValue As String
    5.    
    6.     '<form action="/bonus.php" method="POST">
    7.     '   <p class="center">Combination:<br />
    8.     '       <img src="validate_image.php?id=907af914b95a0fc33c3f33bf6b4f1ec9f4b5c8207f8fc29522efe783d"
    9.     '         alt="Validation Image" />
    10.     '   </p>
    11.     '   <p class="center">
    12.     '       <input type="text" name="Validate" size="6" maxlength="6" />
    13.     '       <br />
    14.     '       <input type="submit" value="Enter Combination!" />
    15.     '   </p>
    16.     '</form>
    17.     '<hr style="clear: both" />
    18.     '<p class="center"><img src="/graphics/pokemon/normal/393M.gif" alt="A Wild Pok&eacute;mon!">
    19.     '   <br />
    20.     '   <strong style="color: red">Look out!</strong> A wild Pok&eacute;mon has attacked you!<br />
    21.     '   <a href="battle.php?Battle=Wild">Battle it now!</a>
    22.     '</p>
    23.     '<p>&nbsp;</p>
    24.     '<p class="center">
    25.     'WebBrowser1.navigate "about:blank"
    26.     Set oHTMLDoc = WebBrowser1.document
    27.     'oHTMLDoc.body.innerHTML = "<form action=""/bonus.php"" method=""POST""><p class=""center"">Combination:<br /><img src=""validate_image.php?id=907af914b95a0fc33c3f33bf6b4f1ec9f4b5c8207f8fc29522efe783d"" alt=""Validation Image"" /></p><p class=""center""><input type=""text"" name=""Validate"" size=""6"" maxlength=""6"" /><br /><input type=""submit"" value=""Enter Combination!"" /></p></form><hr style=""clear: both"" /><p class=""center""><img src=""/graphics/pokemon/normal/393M.gif"" alt=""A Wild Pok&eacute;mon!""><br /><strong style=""color: red"">Look out!</strong> A wild Pok&eacute;mon has attacked you!<br /><a href=""battle.php?Battle=Wild"">Battle it now!</a></p><p>&nbsp;</p><p class=""center"">"
    28.    
    29.     szValue = vbNullString
    30.     For Each oForm In oHTMLDoc.Forms
    31.         If (InStr(1, oForm.Action, "bonus.php", vbTextCompare) <> 0) Then
    32.             For Each oEle In oForm.elements
    33.                 If (oEle.isTextEdit) Then
    34.                     If (LCase(oEle.Name) = "validate") Then
    35.                         szValue = oEle.Value
    36.                         Set oEle = Nothing
    37.                         Set oForm = Nothing
    38.                         Exit For
    39.                     End If
    40.                 End If
    41.             Next oEle
    42.         End If
    43.         If (oForm Is Nothing) Then Exit For
    44.     Next oForm
    45.  
    46.     getBonusFormTextBoxValue = szValue
    47. End Function
    48.  
    49. Private Sub Form_Load()
    50.     getBonusFormTextBoxValue
    51. End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    76

    Re: Entering text in a textbox

    Xiphias3:I tried it but even though it wasn't giving me an error it's still not entering the code in that textbox !

    Got any simpler way

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    76

    Re: Entering text in a textbox

    Resolved.

    I used:

    Code:
    For Each formtext In WebBrowser1.Document.getelementsbytagname("input")
       If formtext.Name = "name of element" Then
       formtext.Value = Text4.Text
       End If
       Next
    Last edited by DragonBoy; Sep 17th, 2009 at 01:05 AM.

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