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

公开课形式1

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

结束类

4

1 回答 1

1

编译器抱怨Match.ToString. ToString是一个实例方法,但是Match是一个类型。

于 2012-11-23T03:53:25.410 回答