简体   繁体   中英

How to bind a checkedlistbox from a property of an object within a list<object>?

below provided code returns a List of Column class object which contains

List<Columns> ColumnNames = new List<Columns>();
        ColumnNames = metadataobj.GetColumns(clbTables.Items[indexofselectedtable].ToString());

How can i bind a checkedlist box with the ColumnNames object ,and display only the Name property of the ColumnNames to the user? I cannot find a DataSource method for my checkedlistbox. Please Help....

just type it straightat
chklistcolumns.DataSource = ColumnNames; chklistcolumns.DisplayMember = "Name"; chklistcolumns.ValueMember = "ID";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM