Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
What i want is when the progress bar hits 100% to open a new window...


(The code when a button open's new window (new home().Show();))


I want to click a button open's a new window about 10 sec. of the bar going through and i get another pop-up...
Posted
Updated 27-Jan-10 14:55pm
v3

OK, you wanted code - here it is, just one of many ways. I'll leave it to you to figure out what it's doing and how to implement it in your project seeing as we're all the 'dumbass'es ;P Good luck
C#
public class CustomProgressBar : ProgressBar
{
    public event EventHandler ValueChanged;

    public new int Value
    {
        get { return base.Value; }
        set
        {
            if (base.Value != value)
            {
                base.Value = value;
                OnValueChanged(EventArgs.Empty);
            }
        }
    }

    protected virtual void OnValueChanged(EventArgs e)
    {
        EventHandler eh = ValueChanged;
        if (eh != null)
            eh(this, e);
    }
}
C#
void customProgressBar_ValueChanged(object sender, EventArgs e)
{
    CustomProgressBar cpb = sender as CustomProgressBar;
    if (cpb != null)
        if (cpb.Value == 100)
            new home().Show();
}
 
Share this answer
 
You update a progress bar by setting its Value property. Whenever you set it to 100, run the code you want to run.
 
Share this answer
 
search for backgroundworker class examples there is a method which will do work on completion
 
Share this answer
 
Zachman221 wrote:
Okay I know what it means but I don't know how to do it dumb ass



Dumb ass here is only you :laugh:

The answer is:
1. read some C# books first.
2. find out what is OOP.
3. come back and answer your question by yourself
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900