我如何等待control_progressbar完成循环中的每个项目 [英] How do i wait the control_progressbar to finish for every item in the loop

查看:83
本文介绍了我如何等待control_progressbar完成循环中的每个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

        private void button2_Click(object sender, EventArgs e)
        {
//I have a List(List_movieLinks) containing 900 strings.
            for (int i = 0; i < List_movieLinks.Capacity; i++)
            {
//I have a custom control(controlFile1) with a progressBar inside.
                if (controlFile1.ready)
                {
//until the progressBar value = 100 (until is full)
// 5 seconds are passing
// but the for loop is not stopping for those 5 seconds.

// how do I wait the progressBar to finish for every item in the loop? 

                }
            }
         }
//thank you





我尝试过:





What I have tried:

yes, it's a progress bar problem after all.
:)
problem solved
I was thinking at the timer element in the same time, but when I narrowed it down to bits, all became clear.
Thank you, all.

推荐答案

你是在for循环中处理ControlFile中的任何动作/步骤吗? ?如果是,那么您必须更新一下自定义逻辑以设置任何标志是否已完成具有自定义控件的操作。



在if条件下添加一个while循环,当controlfile.flag为true时退出
are you processing any action/steps in ControlFile under the for loop? If yes then you have to update custome logic a bit to set any flag whether the action withing custom control is finished or not.

add one while loop within if condition and exit when the controlfile.flag is true


这篇关于我如何等待control_progressbar完成循环中的每个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆