0
我想從列表框中刪除一些文本,並且不斷收到此錯誤。引用非共享成員需要一個對象引用
Error 1 Reference to a non-shared member requires an object reference.
下面是導致錯誤的代碼。
ListBox1.Items.Add(Match.ToString.Replace("color: 0863BB;", "").Replace("</span>", "").Replace(">", "").Replace("""", ""))
這是我下面的完整代碼。 我不知道我在做什麼錯,請幫助。
Imports System.Text.RegularExpressions
公共類Form1中
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Regex As New Regex("color: 0863BB;" & Chr(34) & ">(.*?)</span></span>")
Dim Matches As MatchCollection = Regex.Matches(RichTextBox1.Text)
For Each Match As Match In Matches
ListBox1.Items.Add(Match.ToString)
Next
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
'RichTextBox1.Text = WebBrowser1.DocumentText
End Sub
Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged
ListBox1.Items.Add(Match.ToString.Replace("color: 0863BB;", "").Replace("</span>", "").Replace(">", "").Replace("""", ""))
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
If ListBox1.Items.Contains("<span>") Then
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
' (Match.ToString.Replace("color: 0863BB;", "").Replace("</span>", "").Replace(">", "").Replace("""", ""))
End Sub
末級