DataGridView - Display Row Numbers on Control
-
Hi How can I display row numbers on the left hand side of a datagridview control. (i.e. not in the cells)
-
Hi How can I display row numbers on the left hand side of a datagridview control. (i.e. not in the cells)
hi RichardBerry, try following code Dim i As Integer For i = 0 To datagridview1.Rows.Count - 1 datagridview1.Rows(i).HeaderCell.Value = CStr(datagridview1.Rows(i).HeaderCell.RowIndex + 1) Next hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
-
hi RichardBerry, try following code Dim i As Integer For i = 0 To datagridview1.Rows.Count - 1 datagridview1.Rows(i).HeaderCell.Value = CStr(datagridview1.Rows(i).HeaderCell.RowIndex + 1) Next hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
Hi Rupesh Thanks, that does work I was however hoping for somthing automatic. Also if I delete a row, then I will have to catch that event and renumber the rows. Thanks for your help though :)