Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB righting Text to Webpage

  • 12-09-2014 04:52PM
    #1
    Registered Users, Registered Users 2 Posts: 2,855 ✭✭✭


    Hey Guys

    I am trying to write some code that will write text into a textarea of a webpage.
    I can't seem to get it to work. I'm new to coding and the what I am trying to get done I thought was simple enough. But my ignorance to coding has hit a road block.

    My coding looks like this (VB 2013)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    WebBrowser1.Navigate("https:xxxxxxxxxx")
    WaitForPageLoad()

    Dim textArea As HTMLTextAreaElement

    textArea = WebBrowser1.Document.GetElementById("addbulk").DomElement
    textArea.value = TextBox1.Text

    End Sub



    The textarea I want to add to on the webpage


    <form name="bulkadd" method="post" action="?view=bulkadd">

    <p>Bulk add field:<br></p>

    <input name="view" value="bulkadd" type="hidden">

    <textarea name="bulkadd" cols="100" rows="10" onfocus="this.value = ( this.value == this.defaultValue ) ? '' : this.value;return true;">Enter CSV in the following format:

    Please enter text here
    </textarea>
    <br>

    <a href="?view=bulkadd" class="navbutton" onclick="document.submit();return false;">Submit</a>

    <a href="#" class="navbutton" onclick="document.bulkadd.reset();return false;">Clear Bulk Form</a>

    </form>


    I would like if it added the text as text box1 is filled with information. But at this stage I would be happy to just get it to populate the webpage textarea with the text that the user will put into textbox1.

    I have searched the web. But have yet to find the answer.
    Thanks in advance for any help.


Comments

  • Moderators, Science, Health & Environment Moderators Posts: 9,206 Mod ✭✭✭✭mewso


    You are using the incorrect id value in your code. WebBrowser1.Document.GetElementById("addbulk").DomElement should be WebBrowser1.Document.GetElementById("bulkadd").DomElement.


Advertisement