Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
P

Pelgar

@Pelgar
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can't set Label.Text
    P Pelgar

    Thanks for the quick response Luc! Sorry, I should have pointed out this is in a button click event handler. I will trying doing the calculations in a BackgroundWorker, thanks again! Edit: I added a BackgroundWorker and life is good again. Thanks again Luc! I should have worked this one out for myself. I must be having a bad code day.

    modified on Sunday, January 2, 2011 1:47 PM

    C# help csharp algorithms announcement

  • Can't set Label.Text
    P Pelgar

    I've been working with C# for about 6 months. This is the first time that a little searching has not resolved a problem for me. I'm trying to change the text of a label and update a progress bar in a loop that does some graphic calculations. The progress bar is working fine but the label text does not change until the loop has completed.

            int nImgCnt = m\_Parent.m\_ImageList.Count - 1;
            int nStatBarAdd = 1000 / nImgCnt;
    
            for (int nIdx = 0; nIdx <= nImgCnt; nIdx++)
            {   //FInd Min rectangle that will contain largest image
               lblProg.Text = "Calculating minimum image size. Image " + (nIdx+1).ToString() + " of " + (nImgCnt + 1).ToString();
               lblProg.Focus();        //Tried this just to see if it would work
               lblProg.Invalidate();   //Tried this just to see if it would work
               CurRC = getImageMinSize(m\_Parent.m\_ImageList\[nIdx\]); 
                if (CurRC.Width > MinRC.Width)
                {
                    MinRC.Width = CurRC.Width;
                    MinRC.X = CurRC.X;
                }
                if (CurRC.Height > MinRC.Height)
                {
                    MinRC.Height = CurRC.Height;
                    MinRC.Y = CurRC.Y;
                }
                prgBr.Value += nStatBarAdd;
    
            }
    

    If anyone can help me out with this I will really appreciate it!

    C# help csharp algorithms announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups