Link to home
Create AccountLog in
Avatar of darkpomix
darkpomix

asked on

how can i simulate a Progress bar in c# (Visual Studio.net)

how can i simulate a Progress bar in c# (Visual Studio.net),  please help, with this ,  i try for many times but dont work,  if any can help me ????


Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Could you give some details please?

Are you trying to simulate some kind of process with a normal progressbar?

Or do you want to make you own progressbar?

?...
Avatar of darkpomix
darkpomix

ASKER

no ,  i use a simple progressbar that is included in vs.net , and i need to simulate a process ,
Your question isn't making much sense, darkpomix. What are you trying to simulate? Can you give an example? Are you trying to inherit the progress bar to create your own control? Please be more specific.

Thanks.

Jason
only simulate a process,  with a counter   i guess,   the progress need to fill up  the progressbar, with a standard progressbar,  not my own , thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Something a little more "fluid":

        private void button1_Click(object sender, EventArgs e)
        {            
            button1.Enabled = false;

            Random R = new Random();
            progressBar1.Value = progressBar1.Minimum;

            for (int i = progressBar1.Minimum; i < progressBar1.Maximum; i++)
            {
                System.Threading.Thread.Sleep(R.Next(50, 250));
                progressBar1.Increment(1);
                Application.DoEvents();
            }

            MessageBox.Show("Done");

            button1.Enabled = true;
        }