我正在尝试从列表框中删除一些文本,但我一直收到此错误。
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
Public Class 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
结束班
答案 0 :(得分:1)
编译器抱怨Match.ToString
。 ToString
是一种实例方法,但Match
是一种类型。