Results 1 to 6 of 6

Thread: listen to button click

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    93

    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

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    93
    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

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Try putting this statement in your loop:
    Application.DoEvents()

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    93
    doesnt help dude. my program is ferociously running without caring if i clicked a button or not

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    93
    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
  •  



Click Here to Expand Forum to Full Width