您可以在这里快速查找:


 
您的位置: 编程学习 > asp.net教程 > 200509
文章分类

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02

Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

VB编程
2006: 02

Asp编程
2005: 11 12
2006: 01 02

C++/VC
2005: 10 11 12
2006: 01 02

Delphi
2005: 12
2006: 01 02

其它

 本文章适合所有读者

VB调用webbrowser技巧集2

TechnoFantasy

向Webbrowser中写入HTML内容的几种方法

首先在Form_Load中加入

WebBrowser1.Navigate "about:blank"

确保Webbrowser1可用

 

方法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

 

方法2:

    Dim o
  
    Set o = WebBrowser1.Document.selection.createrange
    Debug.Print o
    If (Not o Is Nothing) Then
        o.pasteHTML "哈哈"
        Set o = Nothing
    End If

 

方法3:

    ´插入文本框
    Dim o

    Set o = WebBrowser1.Document.selection.createrange
   
    o.execCommand "InsertTextArea", False, "xxx"

 

其中方法3是采用了调用execCommand并且传递控制命令的方法,通过这种方法还可以插入图片等页面元素,详情可以参考MSDN的execCommand命令。