It puzzles me, maybe someone can illuminate the light of enlightenment through my ignorance. This is a Windows C # application. I am accessing the contents of a list from a stream. When I try to access it like this
prgAll.Maximum = lbFolders.SelectedItems.Count;
I get an error. However, here is the part that I do not get. If I comment on this line, the next line
foreach (string dir in lbFolders.SelectedItems)
performed just fine.
Edit: As usual, my communication skills are not enough. Let me explain.
I know that accessing GUI elements from threads other than those created was causing problems. I know that the correct way to access them is through the delegate.
My question was basically this: Why can I access and iterate using the SelectedItems object just fine, but when I try to get (not set) the Count property, it explodes.
Kevin
source share