Ask Your Question
0

Can specific order be programmed to add rows to DataGridView?

asked 2021-11-27 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-07 11:00:00 +0000

pufferfish gravatar image

Yes, it is possible to program a specific order to add rows to a DataGridView. You can use the Rows collection of the DataGridView to add rows in a specific order. Here is an example:

dataGridView1.Rows.Add("Row 1", "Column 1", "Column 2");
dataGridView1.Rows.Insert(0, "Row 2", "Column 1", "Column 2");
dataGridView1.Rows.Insert(1, "Row 3", "Column 1", "Column 2");

In this example, the first row is added using the Rows.Add method, and then the second and third rows are inserted at specific positions using the Rows.Insert method. The first parameter of the Rows.Insert method specifies the index at which to insert the new row.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-11-27 11:00:00 +0000

Seen: 15 times

Last updated: Jul 07 '21