c# - ListBox Items Disappear -
i have listbox (called waferslistbox) bounded arraylist of object type (called wafers). when want add listbox dynamically, use following code:
waferslistbox.datasource = null; waferslistbox.datasource = wafers; waferslistbox.refresh(); this changes items in listbox, of items disappear (they're still there , can selected, user can't see them).
any ideas on how fix this?
update: wafer class:
public class wafer { public string maid; public string mid { { return maid; } set { maid = value; } } public wafer(string m) { maid = m; } } this code call, adds copy of selected item listbox:
wafer w = waferslistbox.selecteditem wafer; wafers.add(w); waferslistbox.datasource = null; waferslistbox.displaymember = "mid"; waferslistbox.datasource = wafers; waferslistbox.refresh();
you should tell waferslistbox property use it's caption.
do this;
waferslistbox.displaymember = "propertynamethatyouwanttoshow";
Comments
Post a Comment