locked
how to set colums of the datagrid which binded to bindingsource and the bindingsource.datasource is a collection of a class? RRS feed

  • Spørgsmål

  • public SSOHeaderLForm()

            {

                InitializeComponent();

                this.bindingSource1.DataSource =typeof (DataCollection <SSOHeader > ) ;

    //SSOHeader is a class ,DataCollection<SSOHeader> is a collection of SSOHeader

                this.dataGrid1.DataSource = this.bindingSource1;

                this.Input = new DataCollection<SSOHeader >();

            }

            #region Input

            public override object Input

            {

                get

                {

                    object val;

                    if (this.bindingSource1.DataSource is DataCollection<SSOHeader>)

                        val = this.bindingSource1.DataSource;

                    else

                        val = default(DataCollection<SSOHeader>);

                    return val;

                }

            set

                {

                    this.bindingSource1.DataSource = typeof(DataCollection<SSOHeader>);

                    if (value is DataCollection<SSOHeader>)

                        this.bindingSource1.DataSource = value

                }

            }

            #endregion

     I do not want  some of the properties from the class SSOHeader  to display in the datagrid.

    calling for help??

    16. august 2012 03:06

Svar