如何在Grideview上自动生成SN

如何在Grideview上自动生成SN

本文介绍了如何在Grideview上自动生成SN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们
你好吗
我的问题是我在VB.net表单上有一个Datagrideview,如何通过添加新行Datagrideview自动生成序列号

希望我说得更清楚"

在Advanced

Dear, Budds
how are you
my issue is that i have a Datagrideview on my VB.net Form , how can i auto generate serial number by adding a new row Datagrideview

"I hope it more clear"

Thanks in advanced

推荐答案

Public Sub AutoNumberRowsForGridView(ByVal dataGridView As DataGridView)

    If dataGridView IsNot Nothing Then

    Dim count As Integer = 0

    While (count <= (dataGridView.Rows.Count - 2))

    dataGridView.Rows(count).HeaderCell.Value = String.Format((count + 1).ToString(), "0")

    count += 1

    End While

    End If

End Sub


或浏览此链接-
how-to-add-an-autonumber -column-in-a-datagridview/ [ ^ ]


Or Go through this link-
how-to-add-an-autonumber-column-in-a-datagridview/[^]


这篇关于如何在Grideview上自动生成SN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 19:00