Reputation: 687
Is it possible to convert a StringCollection
variable to a BindingList
, and then back? I am trying to bind a StringCollection
to a DataGridView
, and I am struggling to make it work.
I want to do the same thing with a StringDictionary
.
Do I need to create some sort of wrapper classes to accomplish this...as described in this question.
Thanks for any advice you can give.
Upvotes: 1
Views: 894
Reputation: 687
The answer provided for this question solves the issue I was addressing here. Once I carefully worked through the solution given, and corrected my own errors in implementing it, I was able to get it working.
It is an elegant solution.
Upvotes: 0
Reputation: 5221
Will this work for you ?
StringCollection sc = new StringCollection();
BindingList<String> bl = new BindingList<String>((from String str in sc select str).ToList());
Upvotes: 0