Datagriedview scrollbar track records - C#

Asked

Viewed 75 times

0

I have a Datagriedview where I add my items. When it arrives at a certain number of records on the grid, it adds up and we can’t see the rest. Is there any way to make Scrolbar dynamic? For example, the Scrolbar descend always following the last record?

1 answer

1


Yes, there is.

Let’s assume you have a method where you add the lines to DataGridView by name dataGridView1 (example of line addition per code, without DataBind):

dataGridView1.Rows.Add(new[] { "Linha 1" });

After adding the line just do the following:

dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.GetLastRow(DataGridViewElementStates.Visible);

Browser other questions tagged

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