problem in looping:
-
System results in NOT RESPONDING state. I want to have an infinite loop till end button is pressed. Through looping, I want to monitor few files. I used if, for, do, while, until , but none of them resulted in a fruitful way. Can anyone plz help me how I can achieve such looping. Plz help with examples. Thanks in advance. My code can be viewed here: http://www.codeproject.com/script/Forums/View.aspx?fid=1646&msg=2467756[^]
-
System results in NOT RESPONDING state. I want to have an infinite loop till end button is pressed. Through looping, I want to monitor few files. I used if, for, do, while, until , but none of them resulted in a fruitful way. Can anyone plz help me how I can achieve such looping. Plz help with examples. Thanks in advance. My code can be viewed here: http://www.codeproject.com/script/Forums/View.aspx?fid=1646&msg=2467756[^]
arp_059 wrote:
I want to have an infinite loop till end button is pressed
Then the loop must go on a different thread. If you loop infinitely then your application will not know about the button press because it is too busy looping to handle events.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
System results in NOT RESPONDING state. I want to have an infinite loop till end button is pressed. Through looping, I want to monitor few files. I used if, for, do, while, until , but none of them resulted in a fruitful way. Can anyone plz help me how I can achieve such looping. Plz help with examples. Thanks in advance. My code can be viewed here: http://www.codeproject.com/script/Forums/View.aspx?fid=1646&msg=2467756[^]
You can create a defacto infinite loop with the timer control. Just drag and drop it into your project and when you set the enable property to true it generates an event periodically. You can then write code in that event to check your file. When you want to stop checking then set the enable property to false.
-
System results in NOT RESPONDING state. I want to have an infinite loop till end button is pressed. Through looping, I want to monitor few files. I used if, for, do, while, until , but none of them resulted in a fruitful way. Can anyone plz help me how I can achieve such looping. Plz help with examples. Thanks in advance. My code can be viewed here: http://www.codeproject.com/script/Forums/View.aspx?fid=1646&msg=2467756[^]
-
arp_059 wrote:
I want to have an infinite loop till end button is pressed
Then the loop must go on a different thread. If you loop infinitely then your application will not know about the button press because it is too busy looping to handle events.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
doesn't application.doevents check if anything else has happened/being pressed etc. I've used it before to put an exit function in a loop from a stop button.
Please check out my articles: The ANZAC's articles
-
doesn't application.doevents check if anything else has happened/being pressed etc. I've used it before to put an exit function in a loop from a stop button.
Please check out my articles: The ANZAC's articles
The ANZAC wrote:
doesn't application.doevents check if anything else has happened/being pressed etc. I've used it before to put an exit function in a loop from a stop button.
Yes, but you could end up in some terrible recursion problems if you are not careful. The recommended way is to use separate threads.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
The ANZAC wrote:
doesn't application.doevents check if anything else has happened/being pressed etc. I've used it before to put an exit function in a loop from a stop button.
Yes, but you could end up in some terrible recursion problems if you are not careful. The recommended way is to use separate threads.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
yeh i'm in agreeance, it really depends on the scale of your application too.
Please check out my articles: The ANZAC's articles
-
How about using Timer control? Not so professional but still it gets the job done. :)
- Stop thinking in terms of limitations and start thinking in terms of possibilities -
Hiii..,,, Keep "Application.doevents" in your infinite loop. then Try. Thanks Rajesh B
Rajesh B --> A Poor Workman Blames His Tools <--
-
Hiii..,,, Keep "Application.doevents" in your infinite loop. then Try. Thanks Rajesh B
Rajesh B --> A Poor Workman Blames His Tools <--
Unless you're REALLY careful about what you're doing, using "DoEvents" in a workaround like this is a dangerous thing to do, causing some very difficult bugs to work out.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007