Wednesday, March 2, 2016

Data Grid View Property


1) If you want to change Column Header Colour in DataGridView then first you have to change Property "EnableHeaderVisualStyle" from True to False and then set back colour from property "ColumnHeadersDefaultCellStyle"

2) If you want to column width as per content then set property "AutoSizeColumnsMode" and "AutoSizeRowsMode" to AllCells

3) If you want to change Column Header Height then first change property "ColumnHeadersHeightSizeMode" from AutoSize to EnableResizing.

4) If you want to change row colour alternate then first set the Back colour from property "DefaultCellStyle" and then set the Back colour from property "AlternatingRowsDefaultCellStyle".