Button/busyindicator in other than Click Event - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17

Thread: Button/busyindicator in other than Click Event

  1. #16
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,197

    Re: Button/busyindicator in other than Click Event

    Quote Originally Posted by TBBW View Post
    using the background gives me an unstable program.
    If I runs it 10 times it crashes 2 times randomly.
    That is the fault of how you've coded it, not with background threading.

    Here's what you're doing...
    Quote Originally Posted by TBBW View Post
    Pushing/clicking the install button results in the following
    - Find File.
    - Do a CRC check
    - Run it
    This is what you should be doing:
    OnButtonClick event...
    - Disable the button
    - Prompt the user for the file(s)
    - Create a BackgroundWorker.
    - Wire up progress and completed events
    - Start the thread, which...
    - Find File.
    - Do a CRC check
    - Run it
    - reports back to the main ui thread using the progress event.
    - When the completed event fires, reenable the button.
    Last edited by Arjay; January 18th, 2014 at 03:53 PM.

  2. #17
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,197

    Re: Button/busyindicator in other than Click Event

    The best thing to do is to create a small test app with a start button and when you click it you create the backgroundworker and wire up the events. You disable and reenable the start button and dummy up progress events.

    Then when you have that working well, you incorporate the code into your real project and have the bw thread use the crc methods.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center