Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
QuestionCultureInfo Pin
Rajee Maharjan2-Sep-09 21:12
Rajee Maharjan2-Sep-09 21:12 
AnswerRe: CultureInfo Pin
OriginalGriff2-Sep-09 21:19
mveOriginalGriff2-Sep-09 21:19 
AnswerRe: CultureInfo Pin
stancrm2-Sep-09 21:33
stancrm2-Sep-09 21:33 
QuestionAsk about <> with class name Pin
Anmar-xe2-Sep-09 20:49
Anmar-xe2-Sep-09 20:49 
AnswerRe: Ask about <> with class name Pin
Arun Jacob2-Sep-09 20:55
Arun Jacob2-Sep-09 20:55 
GeneralRe: Ask about <> with class name Pin
Anmar-xe2-Sep-09 20:57
Anmar-xe2-Sep-09 20:57 
QuestionWeird, unexplained occurance... Pin
MarkB7772-Sep-09 20:48
MarkB7772-Sep-09 20:48 
AnswerRe: Weird, unexplained occurance... Pin
OriginalGriff2-Sep-09 21:33
mveOriginalGriff2-Sep-09 21:33 
It's not that unexplained - Think of it this way: If you have a list and you iterate through it, what happens when you delete one of the list entries? What is the next entry for an entry which has been deleted? What happens when the Controls list is traversed by a different process?

Since foreach does effectively that - calls Controls.Next each time round the loop - it is very understandable that at some point you will have a problem. Normally, you would get a "Collection was modified; enumeration operation may not execute" exception, but I guess Dispose doesn't check that!

Use Controls.Remove to take the controls out of the list, then Dispose them. You will need to need to modify the foreach to a for loop (and I suggest iterating backwards from the last to the first, to make it safer.) You will probably find you can rely on the frame work to do the dispose this way.

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

JokeRe: Weird, unexplained occurance... Pin
Greg Chelstowski2-Sep-09 21:37
Greg Chelstowski2-Sep-09 21:37 
GeneralRe: Weird, unexplained occurance... Pin
MarkB7773-Sep-09 1:13
MarkB7773-Sep-09 1:13 
AnswerRe: Weird, unexplained occurance... Pin
Greg Chelstowski2-Sep-09 21:36
Greg Chelstowski2-Sep-09 21:36 
GeneralRe: Weird, unexplained occurance... Pin
OriginalGriff2-Sep-09 21:40
mveOriginalGriff2-Sep-09 21:40 
GeneralRe: Weird, unexplained occurance... Pin
Greg Chelstowski2-Sep-09 21:44
Greg Chelstowski2-Sep-09 21:44 
GeneralRe: Weird, unexplained occurance... Pin
MarkB7773-Sep-09 1:14
MarkB7773-Sep-09 1:14 
Questiondll security Pin
amit_upadhyay2-Sep-09 20:29
amit_upadhyay2-Sep-09 20:29 
AnswerRe: dll security Pin
Arun Jacob2-Sep-09 20:37
Arun Jacob2-Sep-09 20:37 
GeneralRe: dll security Pin
amit_upadhyay3-Sep-09 6:17
amit_upadhyay3-Sep-09 6:17 
AnswerRe: dll security Pin
Arun Jacob3-Sep-09 18:06
Arun Jacob3-Sep-09 18:06 
GeneralRe: dll security Pin
amit_upadhyay3-Sep-09 22:54
amit_upadhyay3-Sep-09 22:54 
GeneralRe: dll security Pin
Arun Jacob3-Sep-09 22:56
Arun Jacob3-Sep-09 22:56 
GeneralRe: dll security Pin
mustang863-Sep-09 6:21
mustang863-Sep-09 6:21 
GeneralRe: dll security Pin
amit_upadhyay3-Sep-09 6:30
amit_upadhyay3-Sep-09 6:30 
GeneralRe: dll security Pin
mustang863-Sep-09 10:22
mustang863-Sep-09 10:22 
QuestionProblem with sorting string using radix sort [modified] Pin
gamer11272-Sep-09 20:16
gamer11272-Sep-09 20:16 
AnswerRe: Problem with sorting string using radix sort [modified] Pin
Calla3-Sep-09 4:53
Calla3-Sep-09 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.