c# - System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource -



c# - System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource -

i'm using c# code below populate winforms listbox. want hide scheme folders however. $recyclingbin example. gives me next error.

system.argumentexception: complex databinding accepts info source either ilist or ilistsource.

being new linq more confusing me. can tell me i'm going wrong?

string[] dirs = directory.getdirectories(@"c:\"); var dir = d in dirs !d.startswith("$") select d; listbox.datasource = (dir.tostring());

change:

listbox.datasource = (dir.tostring());

to:

listbox.datasource = dir.tolist();

dir.tostring() spit out description of enumerable, isn't useful. error message indicates needs list, hence .tolist().

c# winforms linq

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -