dr.ahmed
dr.ahmed

Reputation: 5

write text inside div element use webbrowser vb.net

Need to write in element .

This is the HTML code

< div id="t" class="message-tools__textarea js-scroller" contenteditable="true" data-placeholder="Write a message (Enter to send)">XXXXXX< /div>

My question is how to write text like XXXXXX ?????

Upvotes: 0

Views: 915

Answers (2)

Oak_3260548
Oak_3260548

Reputation: 2000

So, if the text to be replaced is fixed and has only 1 instance within the HTML code, it should be rather simple:

Dim OrigCode, ModifiedCode as string
OrigCode = GetGoogleCodeFromURL  ' get the code
ModifiedCode = OrigCode.Replace("XXXXXXX","ZZZZZZ")

Dim MyHTML as string = "<head>...</head><body><h1>Hello World!</h1><p>&nbsp;</p>" & _
                           ModifiedCode & "<p>&nbsp;</p><p>That's it.</p>"

But usually, things are a bit more complicated, so I'm not sure, if you expressed your wish precisely. Also, if the code is big and action is recursive, it might be better to break it into parts and handle only relevant part of it, due to performance issues.

Upvotes: 2

SEFL
SEFL

Reputation: 569

Add this:

<div id="t" runat="server" ...

And then in your codebehind:

t.InnerText = "XXXXXXX" ' or t.InnerHTML if you're adding HTML code).

Upvotes: 2

Related Questions