VB call WebBrowser skill set 2

Source: Internet
Author: User
Tags insert
Web| techniques several ways to write HTML content to a WebBrowser

First, add in the Form_Load

WebBrowser1.Navigate "About:blank"

Make sure Webbrowser1 is available



Method 1:

Dim S as String
Dim Stream as IStream

s = ""
s = s + ""
s = s + ""
s = s + "

Hello World

"
s = s + ""
s = s + "
WebBrowser1.Document.Write s



Method 2:

Dim o

Set o = WebBrowser1.Document.selection.createrange
Debug.Print O
If (not o to Nothing) Then
o.pastehtml "haha"
Set o = Nothing
End If



Method 3:

' Insert text box
Dim o

Set o = WebBrowser1.Document.selection.createrange

O.execcommand "Inserttextarea", False, "xxx"



Method 3 uses the method of invoking ExecCommand and passing control commands, which can also be used to insert page elements such as pictures, which can refer to the MSDN execcommand command.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.