Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to display serial number against every record in grid view in vb.net windows application, Plz Help
Posted
Updated 2-Feb-11 2:22am
v2
Comments
OriginalGriff 2-Feb-11 8:24am    
That isn't a problem - that's just a statement.
What part is giving you difficulty?
Sunasara Imdadhusen 2-Feb-11 8:41am    
Did you try before?
Henry Minute 2-Feb-11 8:51am    
What serial number?

VB
Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
  e.Graphics.DrawString(e.RowIndex + 1, Me.Font, Brushes.Black, e.RowBounds.X + 15, e.RowBounds.Y + 5)
End Sub
 
Share this answer
 
 
Share this answer
 
Try with this it may work for U
VB
Dim row As DataGridViewRow
            For Each row In DataGridViewRowFileDetails.Rows
                row.Cells("RowName").Value = row.Cells("RowName").RowIndex + 1
            Next



Where RowName is the Name of the Row where you need the serial number in the Grid View
It should be use where U fill the Grid View
 
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