Hi
Is there any way to change the selection curser I have to use a full row selection in my application and now its a blue line and i would like to have something a bit more discret..
I dont know if cursor is the best word.. In vb6 i think it was called the selection fill style.

Datagridview Row selection Style
Alejandro F.
A simple example which I think should show you how to chnage the cell formating.
Public Class Form1
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.Pink
End Sub
End Class
A link the an article dealing with this.
http://msdn2.microsoft.com/en-US/library/z1cc356h.aspx
Hope that helps.
Antonello Bianchi
This is correct. What putting in code in the event does is provide a little bit of flexibility in that I may only want to change the background selection color for column 2 or change background color if the value in the cell is blank. So its giving you programatic control over the properties.
The design time properties do not allow you to code this - but in this example with full row select design time setting of properties should be OK.
ItsMe!!!
Hi,
You can also change the selection style in the IDE.
If you select the DAtaGridView, go to Properties and click the ellipses button beside DefaultCellStyle, you can change the selectionBackColor and SelectionForeColor values.
James Newman
If you want only different columns to have different colors or styles then you don't need to handle CellFormatting event. It is possible to specify DefaultCellStyle for each column at design time.
Handling CellFormatting event could slow down of DataGridView repainting, because it raises CellFormatting for each cell. I think CellFormatting event is good if you want to apply different formats to cell based on the value of cell.