Datagrid for textbox

Asked

Viewed 101 times

0

Boa Pessoal.

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

I’m using the Visual Basic and my database is on SQL Server.

Thank you.

1 answer

1

If I understand correctly, what you want can be obtained by manipulating the event Defaultvaluesneeded:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.