T
tshad
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.primaryForms.Find(delegate(PrimaryForms
pf1)
{ return pf1.FormName.ToLower() == ((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
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.primaryForms.Find(delegate(PrimaryForms
pf1)
{ return pf1.FormName.ToLower() == ((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