Datagrid for textbox

0

Good People.

I have a DataGridView where I have the id field. The id is currently filled with 10 values, ie the last number to appear in my DataGridView is the number "10", and I want to have a TextBox where the next number automatically appears (in this case would be the number "11"), and after inserting the number "11" on the grid would appear the "12".

I am using Visual Basic and my database is in SQL Server .

Thank you.

    
asked by anonymous 28.04.2016 / 13:51

1 answer

1

If I understand correctly, what you want can be achieved by manipulating the DefaultValuesNeeded event:

Private Sub DataGridView1_DefaultValuesNeeded(sender As Object, e As DataGridViewRowEventArgs) Handles DataGridView1.DefaultValuesNeeded
    e.Row.Cells(0).Value = e.Row.Index + 1
End Sub
    
25.05.2016 / 00:44