![](/img/trans.png)
[英]Unable to find assembly System.Diagnostics.DiagnosticSource when using SqlDependency with SignalR in Multiple Projects
[英]Unable to find multiple words on a webpage using richtextbox and documenttext function
我有這個代碼。 有時它在網頁中找到單詞,有時卻找不到。 我不確定是什么問題。 同樣,輸入到richtextbox2.text中的單詞只會找到第一個單詞,因此,如果我將第一個單詞作為“ Cookies”,然后放在該“ Milk”下,則只會查找“ Cookies”。 有沒有辦法讓它查找richtextbox中的所有單詞?
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If WebBrowser1.DocumentText.ToLower.Contains(RichTextBox2.Text.ToLower) Then
MsgBox("its there")
Else
MsgBox("NOT THERE")
End If
End Sub
當RichTextBox中有多個單詞時,它會同時搜索兩個單詞,因為它們都在RichTextBox2.Text中。 您可以一次搜索RichTextBox中的每個單詞或詞組(如果它們位於單獨的行中),如下所示:
for each s in RichTextBox2.lines
If WebBrowser1.DocumentText.ToLower.Contains(s.ToLower) Then
MsgBox(s & " is there")
Else
MsgBox(s & " IS NOT THERE")
End If
next s
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.