An object-oriented programming language developed by Microsoft that can be used in .NET.
Hi
As Dwayne says, this is not an error, just that there are more RGB values that don't have a given name than those that do. If you want, you could offer the User a List of Colours which do have a name and prevent them from using a random RGB unnamed colour.
If that is an option you want to pursue then here is some sample code to show one way to do it.
This is a test example and you should try it out first. All it needs is a new Project with a Default Foem1 and a ComboBox1 and Labels 1 & 2 added via the Designer, then copy/replace the default code with this code.
' Form1 with a ComboBox1 and a Label1
' and a Label2
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' from your post
Dim c As Color = Color.Red
Dim s As String = c.Name ' gives RED
c = Color.FromArgb(255, 222, 111, 200)
s = c.Name 'gives "ffde6fc8" which is
' the RGB values in Hex (as you said)
' Possible alternative
' set up a ComboBox to allow User to
' select only a KnowBolor
ComboBox1.DataSource = [Enum].GetValues(GetType(KnownColor))
End Sub
Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim cb As ComboBox = DirectCast(sender, ComboBox)
Dim c As Color = Color.FromKnownColor(DirectCast(cb.SelectedItem, KnownColor))
Label1.BackColor = c
Label2.Text = CInt(c.A).ToString & ", " & CInt(c.R).ToString & ", " & CInt(c.G).ToString & ", " & CInt(c.B).ToString
End Sub
End Class