how to sync with datagridview columns and object properties

Hi

I try to bind datagridview witha  business object of three public properties. but the column order seems not in sync with the order of business object.

is there any way to control the order of the columns when binding to an object

thanks 


Answer this question

how to sync with datagridview columns and object properties

  • nokushi0

    Please, Coul'd you give us examples about binding datagridview to custom objects
    I'd like to sort and filter objects.
    Thank you.

  • DogCatFish

    Could you post the example you were speaking of

    Thanks


  • Recrehal

    There are several ways you can do this.  You can manually configure the column order in the DataGridView - this is the easiest.  If you are implementing your own bindable list using BindingList<T>, you can sub-class BindingList<T> and implement ITypedList.  ITypedList allows you to override the column order for your custom list.  This is fairly easy to implement and I can provide a sample if you'd like.  You can also implement ICustomTypeDescriptor on your business object - you'll find an article on that here: http://msdn.microsoft.com/msdnmag/issues/05/04/NETMatters/

    Joe Stegman
    The Windows Forms Team
    Microsoft Corp.

    This posting is provided "AS IS" with no warranties, and confers no rights.


  • how to sync with datagridview columns and object properties