Adding a row to a DataGrid and back to an Access DB

I have a DataGrid that is tied to an Access DB. I have the DB initially loaded with 5 records. When my form loads the DataGrid effectively displays the 5 records and I have used the AddressBindingSource.MoveNext and AddressBindingSource.MovePrevious to move through the table. I would like to add a button that now allows the user to add another row.

I have an AddressDataSex.xsd that contains ID (key), FirstName, LastName, Address, City, State fields.

I want the user to be able to add an empty row into the DataGrid ... populate the fields ... then have this data saved back into the Access DB.

Do you have any advice

Thanks, Tom



Answer this question

Adding a row to a DataGrid and back to an Access DB

  • Tim Landgrave

    hi,

    i don't know how can you achive that useing the datagrid but you can get the same result using bindingsource

    MyBindingSource.movelast()

    or even you can go to a new row

    MyBindingSource.AddNew()

    you will find your bindingsource responded to that

    hope this helps



  • Cristiano Leite

    Thanks Shakalama ... but when my data file contains thousands of records tabbing to the end can be a lengthy task. If I'm on record one ... how can I immediately get to the blank row at the end of my DataGrid

    Thanks


  • Alfred Myers - MVP

    just go to the last cell in the datagridview and press tab the row will be created

    hope this helps



  • Adding a row to a DataGrid and back to an Access DB