Not that the trend around here are DataGridView’s or anything, it just seems that the small tid bits of information about things people I expect do quite often with them are always hidden away on a dead server most of the time.

I needed to have a column auto sorted when the application loaded, now this can be done several ways, but in my instance I do not have a DataSource as I am populating the grid manually. This is perhaps the only way to specify a sort on a manually populated table (short of clicking the header yourself)…

dgv.Sort(dgv.Columns.GetLastColumn( DataGridViewElementStates.Visible, DataGridViewElementStates.None), ListSortDirection.Descending);

Luckily for me this code is quite nice on the one line, however, if the column you want auto sorting isn’t either the first or last one, your going to have to go through each column until you have found the one you want.