Here is a method to auto number using a DGV that is not bound to a data source. The code places the auto numbering in column zero. Place a DataGridView on the form and add the desired number of columns.
i am using windows application with C#.I want to display Serial number in datagridview.
Benjamin3 Answers
You need to bind DataBindingComplete event of datagridview.
It's work for me.
In WinForms Applications, to display the row number in the row header, we could use the RowPostPaint event of DataGridView control.
Usage: Suppose grid is named as dgvUserDetails
Delegate
Code
Don’t try to manipulate the Code part much because the X and Y are calculated co-ordinates in the row header area or you can customizse test it yourself to see the various results. Trio stealth tablet.
Result
Durgesh Pandey