|
-
Oct 21st, 2002, 03:48 AM
#1
Thread Starter
Lively Member
listen to button click
i have a search program that reads web pages. the problem is once it starts reading, it never stops whatever i try to do to make it stop. how can I add a button on the page and make it listen to button click and stop doing what it is doing ? i have heard about threading but i dont know how to use. would this be the case that i want to use threading ? some sample code could help
thanks
-
Oct 21st, 2002, 07:57 PM
#2
Thread Starter
Lively Member
sorry for repeat. is it not possible at all ? how do i listen to button click event while between every loop of my function ? i believe there should be some way
-
Oct 21st, 2002, 08:07 PM
#3
PowerPoster
Try putting this statement in your loop:
Application.DoEvents()
-
Oct 23rd, 2002, 04:10 AM
#4
Thread Starter
Lively Member
doesnt help dude. my program is ferociously running without caring if i clicked a button or not
-
Oct 23rd, 2002, 10:54 AM
#5
PowerPoster
What you want is a class variable boolean. Set it to false in the constructor, or before your loop. In your cancel button click event, you set it to true.
In your loop, first do the Application.DoEvents(), then check if the variable is true. If it is, exit the loop. If it is still false then continue looping.
If your still haveing problems, post your code. I will make it work. I do this same thing in my app in a couple places.
-
Oct 24th, 2002, 12:10 AM
#6
Thread Starter
Lively Member
done deal dude thanks a bunch
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|