C# programmers (question about progressbar and threads)

Discussion in 'OT Technology' started by D1G1T4L, Jul 10, 2005.

  1. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    is there a way to use a progressbar with a thread to monitor and show the user when the thread stops running.....

    i got a program running with a sign off button, whenever a user clicks sign off, this code gets executed
    Code:
    		private void button1_Click(object sender, System.EventArgs e)
    		{
    			Thread backgroundThread = 
    				new Thread(new ThreadStart(tc.SignOff));
    			backgroundThread.Start();
    
    			aimObject.Show();
    			this.Dispose();
    		}
    
    now tc.SignOff takes a while..... and i wanted the user to see the process of when the thread stops
     
  2. Jericho

    Jericho Active Member

    Joined:
    Oct 21, 2002
    Messages:
    34,140
    Likes Received:
    0
    yes there is, unfortunatly for you, I don't know C#
     
  3. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    :hs:
     
  4. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    ok what i did was this

    Code:
    public delegate void SayHiDelegate(string msg);
    
    private void button1_Click(object sender, System.EventArgs e)
    		{
    			Thread backgroundThread = 
    				new Thread(new ThreadStart(SignOff));
    			backgroundThread.Start();
    
    
    			label1.Text = "Signing Off... Please Wait...";
    
    
    
    		}
    
    
    
    		private void SignOff()
    		{
    			
    			tc.SignOff();
    			this.Invoke(new SayHiDelegate(SayHi));
    			aimObject.Show();
    
    	
    	
    		}
    
    		private void SayHi(string msg)
    		{
    			this.Dispose();
    		}
    
    
    however this.Dispose(); for some reason doesnt execute, what am i doing wrong?
     
  5. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    i changed SayHi(string msg) to just SayHi() and it started working

    and public delegate void SayHiDelegate(string msg); to public delegate void SayHiDelegate();
     

Share This Page