sort Dataview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tshad

    sort Dataview

    In my program, I have a dataview that I am sorting (dv.sort) and then making
    changes to it. I thought I was going to have to re-sort the dataview, but
    it seems that it was already re-sorted when I looped through it??? When
    does that happen? Does it re-sort itself after each change?

    dv.Sort = "primary DESC,formName DESC";

    foreach (DataRowView r in dv)
    {
    PrimaryForms pf = AppSettings.pri maryForms.Find( delegate(Primar yForms
    pf1)
    { return pf1.FormName.To Lower() == ((string)r["formName"]).ToLower();});

    if (pf != null)
    r["primary"] = "True"; <------ Change made here
    }

    // At this point the DataView seems to be resorted

    foreach (DataRowView r in dv)
    {
    string s;
    string s2;
    s = (string)r["primary"];
    s2 = (string)r["formName"];
    }


    Thanks,

    Tom


Working...