N
NvrBst
A few quick questions if possible.
1 - If I have a "List<..> myList" and set it as a datasouce for say
ListBox1, then change items in "myList" is the correct/only way to
update the ListBox with the following?
ListBox1.DataSource = null;
ListBox1.DataSource = myList;
2 - BindingList<...> is the same as List<...> except when it is set as
a datasource then it auto updates the ListBox on changes (One Way
Only) basically? Should I pretty much always be using
BindingList<...> if its being used as a datasouce and items are
changing? Is there an easy way to search MSDN for all Data Storage
Types that AutoUpdate when bound to a DataSource or is this basically
the only one?
3 - When Using the foreach enumeration I always seem to run into
"collection can't change" exception, and then forced to copy the
elements I want using the "CopyTo(..)" (of if I'm lucky and the
collection has it - ToArray()), or just use the simple
"for(...)" (Which is what I usally do since I don't like using up the
extra memory with the copy/toarray). Basically wondering if I am
doing this the right way or is there something else that the
getEnumeration makers put in place for me in these situations.
Thanks. I know these are probably really basic questions but I run
into them so often and just want to make sure I'm doing it the best
way I can.
1 - If I have a "List<..> myList" and set it as a datasouce for say
ListBox1, then change items in "myList" is the correct/only way to
update the ListBox with the following?
ListBox1.DataSource = null;
ListBox1.DataSource = myList;
2 - BindingList<...> is the same as List<...> except when it is set as
a datasource then it auto updates the ListBox on changes (One Way
Only) basically? Should I pretty much always be using
BindingList<...> if its being used as a datasouce and items are
changing? Is there an easy way to search MSDN for all Data Storage
Types that AutoUpdate when bound to a DataSource or is this basically
the only one?
3 - When Using the foreach enumeration I always seem to run into
"collection can't change" exception, and then forced to copy the
elements I want using the "CopyTo(..)" (of if I'm lucky and the
collection has it - ToArray()), or just use the simple
"for(...)" (Which is what I usally do since I don't like using up the
extra memory with the copy/toarray). Basically wondering if I am
doing this the right way or is there something else that the
getEnumeration makers put in place for me in these situations.
Thanks. I know these are probably really basic questions but I run
into them so often and just want to make sure I'm doing it the best
way I can.