Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.