[RESOLVED] Background color
I have an array holding certain color values (ie whitesmoke, samon etc) which is obtained from an external text file. A bit like a style sheet. anyway, these values are loaded into an array and used to change the style of the application. The only issue is im getting a few errors.
Code:
Me.BackColor = Color.StyleConfig(0)
Does not work.
Re: [RESOLVED] Background color
Nice. It wouldn't hurt to check that the colour it returns is a valid colour before using it, though. Look to the Color.IsKnownColor Property, which returns a Boolean.
Code:
Dim bckColour As Color = Color.FromName(styleConfig(0))
If bckColour.IsKnownColor Then
Me.BackColor = bckColour
Else
MessageBox.Show("Unknown colour: " & styleConfig(0))
End If
Re: [RESOLVED] Background color
Quote:
Originally Posted by
Inferrd
Nice. It wouldn't hurt to check that the colour it returns is a valid colour before using it, though. Look to the Color.IsKnownColor Property, which returns a Boolean.
Code:
Dim bckColour As Color = Color.FromName(styleConfig(0))
If bckColour.IsKnownColor Then
Me.BackColor = bckColour
Else
MessageBox.Show("Unknown colour: " & styleConfig(0))
End If
Good point. Thanks for that.