I need to insert some sequence numbers into a table for use by another application. The only way I could think of doing this was to use a data grid view to get the records in the sequence I want them by sorting the binding source as shown below. this.trunkMatrixBindingSource.Sort = "Depart_Time_Mins ASC";this.trunk_MatrixTableAdapter.FillByScenario(this.linehaulDataSet.Trunk_Matrix);int seqNo = 1;for (int i = 0; i <= this.trunkMatrixDataGridView.RowCount - 1; i++){this.trunkMatrixDataGridView.Rows[i].Cells["Depart_Seq_No"].Value = seqNo;seqNo++;}this.trunk_MatrixTableAdapter.Update(this.linehaulDataSet.Trunk_Matrix);
This seems rather clumsy and I'm sure someone can tell me of a much better way of doing it.More specifically it does not apply the sequence number to the record represented by the first row in the data grid. I would really like to understand why this is.
I have a number of other examples where data bindings appear not to get updated as I would expect/want them to. So maybe I have a basic misunderstanding somewhere.
Thanks for any help.