Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to define argb color in
Datagridview.DefaultCellStyle.SelectionBackColor
but this error display

System.InvalidCastException: 'Conversion from string "204, 0, 0" to type 'Integer' is not valid.'


FormatException: Input string was not in a correct format.


What I have tried:

DG_Invoice_Search.DefaultCellStyle.SelectionBackColor = Color.FromArgb("204, 0, 0")
Posted
Updated 10-Jan-19 7:05am

1 solution

You can not use a string, it should be:
Color.FromArgb(204, 0, 0)
See: Color.FromArgb : Color « 2D Graphics « VB.Net Tutorial[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900