locked
DataGridView empty space at the end of last Column RRS feed

  • Question

  • Hi,
    I am using DataGridView control in my Form.
    I have multiple columns in DataGridView.
    If i resize any column and if total width of all columns is less than the width of DataGridView then i get empty space at the end of last column.
    Now if set AutoSizeColumnsMode property of DataGridView to Fill, then after resizing (expanding) any single column, all columns fits within available space and horizontal scroll bar is not visible.

    My requirement is somethink like DataGridView in TaskManager, i.e. if you resize column and total witdh of all columns is less than the width of DataGridView then a empty column is get added automatically to fill empty space and if width is more or equal to width of DataGridView then empty column is removed and horizontal scroll bar is visible.

    Which all properties should i set in DataGridView, which gives me this kind of functionality.

    1) If all columns width is less than DataGridView width then empty coulmn should be visible to fill empty space. 
    2) If all columns width is more than DataGridView width then horizontal scroll bar should be visible and also empty column should not be visible.


    Thanks and Best Regards,
    Nikhil Sharma
    Friday, January 22, 2010 1:42 PM