Posted on 2009-05-17
Last Modified: 2013-11-27
I am making a application in microsoft visual basic 2008 express edition using as the programming language.

What I want to do is get the contens of a textbox on my webbrowser by using GetElementByID then putting the contens into my RichTextBox1 I'm not sure how I would do this so can you help please.

I think that I need to but the contens to string then do RichTextBox1.Text = stringname

Cyberdemon1337 :D

If you have any diffuculty understanding what I said then just message me and I will try to explain it a bit more :)
Question by:CyberDemon1337

Accepted Solution

CyberLex earned 40 total points
ID: 24407029
Public Class Form1

    'create a webbrowser object

    Dim wb As New WebBrowser

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'supress javascript errors (just in caste :=)

        wb.ScriptErrorsSuppressed = True

        'load the webpage


        'add event handler to documentCompleted sub

        'will be called when html is completely loaded

        'from wb.navigate

        AddHandler wb.DocumentCompleted, AddressOf documentCompleted

    End Sub

    Public Sub documentCompleted(ByVal sender As Object, ByVal e As System.EventArgs)

        'search the dropdownbox with name "mydropdown"

        Dim myid As HtmlElement = wb.Document.GetElementById("mydropdown")

        'get the elements of <select> with name "option"

        Dim myelements As HtmlElementCollection = myid.GetElementsByTagName("option")

        'itterate through all of those and add to textbox with a linefeed

        For Each ele As HtmlElement In myelements

            RichTextBox1.AppendText(ele.InnerText & vbCrLf)


    End Sub

End Class

Open in new window


Author Closing Comment

ID: 31582395
Very nice and helpful thanks :)

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now