CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2012
    Posts
    1

    Basic Threading Problem

    I just want a label to show a loading message before executing a bunch of code. I wrote this:
    Code:
            private void LoadQueue()
            {
                displayRangeAuditLabel.Visible = false;
                sortByComboBox.Visible = false;
                showLateCheckBox.Visible = false;
                lblQueueLoading.Visible = true;
    
                if (LoadingThread != null && LoadingThread.IsAlive) LoadingThread.Abort();
    
                LoadingThread = new Thread(new ThreadStart(BindAuditQueue));
                LoadingThread.Start();
            }
    This works and displays my label about half the time - the other half, it only grays out the background area of the label. I suck at threads. What's wrong?
    Last edited by BioPhysEngr; January 3rd, 2013 at 12:53 AM. Reason: code tags

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Basic Threading Problem

    You need to show a more complete code snippet. The code you posted is missing the BindAuditQueue thread proc implementation.

  3. #3
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Basic Threading Problem

    Also, if you use [code] and [/code] tags, it will preserve formatting (I have modified your original post to include these).
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

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

Featured