

R = R + 1 'Add "1" to the value read in the line above R = Integer.Parse(DataGridView1.Item(0, CR).Value) ' read the value in column 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickĬR = Integer.Parse() Me.DataGridView1.Item(0, 0).Value = 1 '"1" or any number where you want to start Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Here is the code:ĭim R As Integer 'Number in column 0 based on value set in Form1_Load Place a DataGridView on the form and add the desired number of columns. The code places the auto numbering in column zero. Here is a method to auto number using a DGV that is not bound to a data source.
