October 26, 2011
You can render row numbers for DataGridView and DataGridViewX by handling RowPostPaint event. Then you use following code: C#: void DataGridViewRowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { DataGridView dg = (DataGridView)sender; // Current row record string rowNumber = (e.RowIndex + 1).ToString(); // Format row based on number of records displayed by using leading zeros while (rowNumber.Length […]