I'd like to delete and add data to a access database using DataGridView1. I know there's a more elegant solution using OleDb.OleDbConnection but I want to do something a little simplier.

So this is what I did so far. I added a DataGridView1 linking to an access database.

i=0
Do while ... end of text file
Read first line from text file
DataGridView1.Item(1, i).Value = line_by_line
i = i+1
Loop

The problem is if the data from the text file is longer that the number of rows in the datagridview I get an error. If the text file is shorter, the remaining existing data in the datagridview is not cleaned out. Any suggestions?