如何在网格视图中获取序列号 [英] How to get serial number in grid view
本文介绍了如何在网格视图中获取序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在vb.net Windows应用程序的网格视图中的每条记录上显示序列号,请帮助
I need to display serial number against every record in grid view in vb.net windows application, Plz Help
推荐答案
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
我想你是说这个...
在asp.net的GridView中自动生成行号 [^ ]
I think you mean this...
Auto Generate Row Number in GridView in asp.net[^]
尝试一下,它可能适用于U
Try with this it may work for U
Dim row As DataGridViewRow
For Each row In DataGridViewRowFileDetails.Rows
row.Cells("RowName").Value = row.Cells("RowName").RowIndex + 1
Next
其中RowName是需要在Grid View中使用序列号的行的名称
应该在U填充网格视图的地方使用
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
这篇关于如何在网格视图中获取序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文