Visual Basic错误BC30456'RED不是'COLOR'的成员

时间:2018-02-16 07:15:55

标签: vb.net error-handling colors

我不知道为什么但.net只是在我想将richtextbox1.text颜色更改为红色时向我显示错误

    Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
    Dim theColor As System.Drawing.Color
    Dim loc As Int16
   the colour to red.
    If RichTextBox1.Text.Contains("CARD LOCKED") Then
        loc = RichTextBox1.Find("CARD LOCKED")
        RichTextBox1.Select(loc, 11)
        RichTextBox1.SelectionColor = COLOR.red   'ERROR
        RichTextBox1.ForeColor = COLOR.red       'ERRROR

    End If
End Sub

1 个答案:

答案 0 :(得分:2)

尝试使用System.Drawing.Color.Red

更改COLOR.red

此外,您应该将'loc'类型更改为Integer以避免隐式转换。