Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, newbie here.

So, I want to make a program, which will open up a website with GeckoWebBrowser. There in that website is a text box, and I want to insert a text into that text box.

For instance, on a classic web browser I would do this:
WebBrowser1.Document.GetElementById("word").InnerText = "gehen"

Now, I would like to do the same thing in GeckoWebBrowser, but the problem is that it doesn't seem to have the innerText control.

Here is the part of the html code:
<pre><pre><input id="word" class="input_style ui-autocomplete-input" type="text" maxlength="50">


And the link to the website for the better view:
https://www.dict.com/German-English

What I have tried:

Here's what I've tried...

1st try:
GeckoWebBrowser1.Document.GetElementById("word").TextContent = "gehen"

2nd try:
GeckoWebBrowser1.Document.GetElementById("word").SetAttribute("text", "gehen")

3rd try:
What I got from some forum:
Dim myElement As Gecko.GeckoHtmlElement = Nothing
Dim myDoc As Gecko.GeckoDocument = GeckoWebBrowser1.Window.Document
myElement = myDoc.GetHtmlElementById("word")

If myElement IsNot Nothing Then
    myElement.InnerHtml = "gehen"
End If


And that's about it. I've been trying this for a whole week, but I just don't seem to find an answer to my question. I've searched on different forums, I might as well have searched the whole web, but no luck.

I really hope you can help, and thank you very, very much for it.
May the rest of your day be as amazing as the taste of a chocolate :)
Posted
Updated 17-Jan-18 0:33am
v2
Comments
Richard MacCutchan 12-Jun-17 4:00am    
Duplicate question removed.
Richard Deeming 12-Jun-17 14:03pm    
Is there a Value property?

If not, try: SetAttribute("value", "gehen")
Member 13254081 13-Jun-17 1:41am    
Nope, tried just now and it didn't work, but thanks anyway... Any other suggestions?

1 solution

Hi, Member 13254081.

I used something like this.

Dim inputter As GeckoTextAreaElement = DirectCast(GeckoWeb.Document.GetElementById("wpTextbox1"), GeckoTextAreaElement)


then this...

inputter.ScrollIntoView(True)
                inputter.Focus()
                inputter.SelectionDirection = "forward"
                inputter.SelectionStart = inputter.Value.IndexOf("<!-- ProtoItem-Name:", StringComparison.Ordinal)
                inputter.SelectionEnd = inputter.Value.IndexOf("}}", StringComparison.Ordinal)
                inputter.Select()
                inputter.Focus()
                inputter.Value = etwasvordemquelltext & tempgegenstand.SeitenQuellText & vbNewLine & etwasnachdemquelltext


this is used to cahnge the selection on a Combobox it think....

But the most Importent is the "inputter.Value" of the
GeckoTextAreaElement 


c.u. Zui from Hamburg
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900