I want to build loading form which I set logo to form and progress bar (For progress bar i build user control).
Here is my Code:
private void frmLoading_Load(object sender, EventArgs e)
    {
        this.TransparencyKey = Color.Turquoise;
        this.BackColor = Color.Turquoise;
        pLogo.Image = Image.FromFile("Logo.png");
        Task.Factory.StartNew(() => Progress());
    }
private void Progress() {
        int sleepTime = 200;
        ucProgressBar.Minimum = 0;
        ucProgressBar.Maximum = 100;
        int value = 0;
        for (value = 0; value < 10; value++)
        {
            ucProgressBar.Value = value;
            Thread.Sleep(sleepTime);
        }
        ucProgressBar.Status = "Setting";
        for (value = 10; value < 20; value++)
        {
            ucProgressBar.Value = value;
            Thread.Sleep(sleepTime);
        }
        ucProgressBar.Status = "Printer";
    }
when it execute in the first loop, it alert error:
"Cross-thread operation not valid: Control 'ucProgressBar' accessed from a thread other than the thread it was created on."
thanks for help!
 
    