You can sort the bindinglist object and rebind it to datagridview.

As for question 2. You can iterate through the bindinglist and create
a dynamic datatable out of that.

On Oct 13, 8:32 pm, Dewang Lakhani <[email protected]> wrote:
> Hi,
>
> I need to sort a datagridview. The datagridview is currently loaded from a
> myCustomObject collection. Like
> BindingList<MyCustomObject> myList = BindingList<MyCustomObject>();
> datagridview1.datasource = myList;
>
> Now if the user clicks on the sort button. I need to sort is dynamically on
> the columns which the user has selected. I know one way is to get DataView
> and sort it. But how do i get a dataView if I do not have a DataTable as
> there is no database involved. Please help.
>
> Question 2) How can I get a dataTable from an existing DataGridView if there
> is no database involved.
>
> Thanks & Regards,
> Dewang

Reply via email to