Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a datagridview in VB.NET ,now I want to edit the first column of this datagridview to index column that display index of rows from 1 to n(n is the number of row).

Everyone help me please.

Thanks in advance.
Posted

1 solution

I'm not sure what you mean by the "first column." If it's the normally gray column that has the row headers, then you need to change the row header text for each row and put the numbers there. For example:
VB
Me.DataGridView1.Rows.Item(Index).HeaderCell.Value = Index.ToString()


If you really mean the first column, then put the row number in the first cell on each row.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900