Priyanka
Priyanka

Reputation: 300

Add new row at bottom of datagridview in Winform

I have a datagridview in Winform application. When I click on add button I want a blank row to be inserted at the bottom of datagridview.

I tried this one:

dataGridView1.Rows.Add(row);

But blank row is inserted at top not at the bottom. Is there any way to insert it at the bottom?

Upvotes: 3

Views: 8182

Answers (1)

Sirwan Afifi
Sirwan Afifi

Reputation: 10824

you can use Insert method:

dataGridView1.Rows.Insert(dataGridView1.Rows.Count-1, row);

Upvotes: 3

Related Questions