Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB righting Text to Webpage

  • 12-09-2014 3: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,035 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