I'm a newbie to this linq stuff. I never used any linq before. So when I had a scenario to move selected items from left list to the right list, I've got a nice solution from search which is in C#, but I converted it into VB. here is the code I've got
Dim leftItems = lb_left.Items.Cast(Of ListItem)().ToList()
Dim rightItems = lb_right.Items.Cast(Of ListItem)().ToList()
'Get all selected items from left box
Dim LeftSelectedItems = leftItems.Where(Function(a) a.Selected).ToList()
'Add all selected items to right box
'Clear lb_right Items and add sorted list
lb_right.Items.Clear()
LeftSelectedItems.Union(rightItems).OrderBy(Function(a) a.Text).ToList().ForEach(Function(b) lb_right.Items.Add(b))
'Remove all selected items from left box
LeftSelectedItems.ForEach(Function(a) lb_left.Items.Remove(a))
The above is the code I got from internet to move left to right list box. But on that function in the ForEach it is giving me a kinda error "Expression does not produce a value"
I really got stucked with this error. Requesting your fast reply..