I have some problem with DataGridView in C#.
case is:
I do some update on database then I reload DataGridView with new values:
myDataGridView.Dat
Ok, I found the solution, maybe it will help somebody: [btw. I made some language mistake filtering = sorting ;-)]
DataGridViewColumn oldColumn = dataGridView1.SortedColumn;
ListSortDirection direction;
if (dataGridView1.SortOrder == SortOrder.Ascending) direction = ListSortDirection.Ascending;
else direction = ListSortDirection.Descending;
databaseUpdateFunction();
DataGridViewColumn newColumn = dataGridView1.Columns[oldColumn.Name.ToString()];
dataGridView1.Sort(newColumn,direction);
newColumn.HeaderCell.SortGlyphDirection =
direction == ListSortDirection.Ascending ?
SortOrder.Ascending : SortOrder.Descending;
I used parts of code from : link text