怎么实现在webbrowse控件中的查找网页中的字符串。

解决方案 »

  1.   

    Private Sub munsearchnext_Click()
    If matchcase = True Then
    pos = InStr(pos + 1, frmmain.Text1.Text, searchstr)
    Else
    pos = InStr(pos + 1, frmmain.Text1.Text, searchstr, vbTextCompare)
    End If
    If pos <> 0 Then
    frmmain.Text1.SelStart = pos - 1
    frmmain.Text1.SelLength = Len(searchstr)
    Exit Sub
    Else
    MsgBox "没有找到字符" & Chr$(34) & searchstr & Chr$(34)
    End If帮你写一个在文档中查找的方法吧,,,然后你改一下就可以用到你那去了,,
      

  2.   

    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Sub Form_Load()
    WebBrowser1.Navigate "http://community.csdn.net/Expert/topic/3297/3297803.xml"
    End Sub'调出查找对话框
    Private Sub Command1_Click()
        WebBrowser1.SetFocus
        keybd_event 17, 0, 0, 0
        keybd_event 70, 0, 0, 0
        keybd_event 70, 0, 2, 0
        keybd_event 17, 0, 2, 0
    End Sub
      

  3.   


    想在WebBrowser,中的网页里,查找一个字符串怎么做?????
      

  4.   

    把网页的内容得到,保存在字符串中
    再用instr查找
      

  5.   

    Private Sub Command1_Click()
        WebBrowser1.Navigate "http://www.applevb.com"
    End SubPrivate Sub Command2_Click()
        Dim doc
        Dim rang    WebBrowser1.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
        Set doc = WebBrowser1.Document
        
        Set rang = doc.selection.createrange
        rang.findtext "dll", 0, 0
        rang.Select
        
        WebBrowser1.SetFocus
    End Sub
      

  6.   

    sub FindText (str)
         dim docText
         Set doc = WebBrowser1.Document
         set docText = doc.body.createTextRange
         docText.findText(str)
         docText.select
     end subOr, if you still really, really want to use the browser's "Find" dialog, I suppose you could write an ActiveX&reg; control, which would do a SendKeys of a Ctrl+F to the browser