Friday, May 1, 2009

Convert HEX color to System.Drawing color

I am working on a data grid at the moment - and one of the requirements of the grid was to have a clickable image as the remove button AND to have the whole row change colors when the image was clicked. In my googling I came across this method:

Protected Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As DataGridCommandEventArgs)

e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#ADD6FF")

End Sub

I added this to the codebehind for the click event and viola it works perfectly!

No comments:

Post a Comment