string ColumnName = table.Columns[e.ColumnIndex].ColumnName;
string AllSort = "";
bool cond = true;
for (int i = 0; i < Sort.Count; i++)
{
if (Sort[i] == ColumnName + " DESC")
{
Sort.RemoveAt(i);
cond = false;
break;
}
if (Sort[i] == ColumnName)
{
Sort[i] += " DESC";
cond = false;
break;
}
}
if (cond)
{
Sort.Add(ColumnName);
}
for (int i = 0; i < Sort.Count; i++)
{
AllSort += Sort[i];
if (i != Sort.Count - 1) AllSort += ",";
}
bindingSource1.Sort = AllSort;