Currency Manager position change resulting in change in dataset RRS feed

  • Question

  • I needed to retain selection of a row in a datagrid.

    For this the selected row was stored using currencymanager.current property. After making necessary changes (which changes the order of rows in the grid) the previously stored row was searched in dataset.table and the currencymanager.position was set to that of the stored row.


    Code sample:


    TableDataSet.TableRow tableRow = null;


    if (this.tableCM.Count > 0)             //tableCM : currency manager

    tableRow = (this.tableCM.Current as DataRowView).Row as TableDataSet.TableRow;


    //some processing is done here which results in grid's row's rearrangement


    for (int i = 0; i < this.tableCM.Count; i++)


    if (this.tableDS.TableIdea.TableID==tableRow.TableID)          //tableDS : data set



    //tableDS.HasChanges() returns false.

    this.tableCM.Position = i;                  //here lies the culprit

    //tableDS.HasChanges() returns true.







    This procedure works well in other cases, but due to some reason it is not working in a particular case whose exact replica is given above. I have not been able to find out its cause. Can anyone help me with this or suggest any probable cause?


    Wednesday, June 27, 2007 7:47 AM