ScrollBar in DataGridView

后端 未结 3 1576
南旧
南旧 2020-12-20 06:00

I have a winform in vs2008 that contains a DataGridView. The datagrid contains a list with several columns. These are fixed width, exept one that I have set up to take whate

3条回答
  •  心在旅途
    2020-12-20 06:25

    In my case, (re)sorting the grid helped. Try sth like this:

     if (gridName.SortedColumn == null)
       gridName.Sort(gridNameColumns[columnName],ListSortDirection.Ascending);
     else
     {
        ListSortDirection dir;
        if (gridName.SortOrder == SortOrder.Descending) 
           dir = ListSortDirection.Descending;
        else dir = ListSortDirection.Ascending;
    
        gridName.Sort(gridName.SortedColumn, dir);
     }
    

提交回复
热议问题