I am trying to change the color of a control from a srting value in a sql database.
The test value in the field is "black" as a string. I can not seem to convert the string to system.drawing.color.
Below is my code
Dim labelcolor As System.Drawing.Color
Dim strSQL As String = "Select * from startup"
Dim myConnection As New SqlConnection(connectionstring)
Dim sqlCmd As New SqlCommand(strSQL)
Dim sqlReader As SqlDataReader
sqlCmd.Connection = myConnection
sqlReader = sqlCmd.ExecuteReader
If (sqlReader.Read()) Then
labelcolor = ctype (sqlReader("headerarea2",System.Drawing.Color))
HeaderLabel.BackColor = labelcolor
Catch exp As Exception
lblerror.Text = exp.ToString