Tolle Sache, sehr praktisch! An folgender Stelle (in der Zeile
"colorCode = int.Parse(hexString,...)") erhalte ich eine
1 | int colorCode = Color.Red.ToArgb();
|
2 | try
|
3 | {
|
4 | string hexString = this.textBoxSLRGB.Text;
|
5 | if (hexString.Length == 6)
|
6 | {
|
7 | hexString = "FF" + hexString;
|
8 | }
|
9 | colorCode = int.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
|
10 | }
|
11 | catch
|
12 | {
|
13 | colorCode = Color.Red.ToArgb();
|
14 | this.textBoxSLRGB.Text = colorCode.ToString("X").Substring(2, 6);
|
15 | }
|
Erhalte ich folgende Meldung:
A first chance exception of type 'System.FormatException' occurred in
mscorlib.dll
Wie kann ich dies verbessern??