I have a datatable with one column:
this.callsTable.Columns.Add("Call", typeof(String));
I then want to add a row to that datatable, but want to give a specific index, the commented number is the desired index:
this.callsTable.Rows.Add("Legs"); //11
Update:
- Must be able to handle inputting hundreds of rows with unique indexes.
- The index must be what is defined by me no matter if there are enough rows in the table or not for the insertat function.
You can use
DataTable.Rows.InsertAt
method.See: DataRowCollection.InsertAt Method