Use a BindingSource to bind your table to the DataGridView, then use the BindingSource's Sort property to specify the columns and directions to sort. E.g.:
bindingSource.Sort = "username, filename";
You can also specify the direction of the sort, e.g.:
bindingSource.Sort = "username ASC, filename DESC";