进度条和数据处理 [英] Progress Bar And Data Process

查看:123
本文介绍了进度条和数据处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好人,

我有一个简单的问题。对于我的应用程序中的屏幕,在加载之前,我需要从数据库中获取数据,执行一些计算,然后将其加载到屏幕上。但是,在这个过程中,我不想软件只是冻结,我希望进度条指示正在加载屏幕的进度。

我的问题是:如何使进度条显示在从数据库获取数据和更新屏幕的过程中的进展?

谢谢,
Blitz

解决方案

你应该看看 BackgroundWorker组件


我创建了我的 ProgressWorker文章正是出于此目的。


您好


您只需设计一个包含进度条控件的表单,并将进度条控件的修饰符属性设置为公共。在主窗体中创建进度条控件表单的intance。在创建实例后设置maximum,minimum和value属性值。在此过程中增加value属性,并为每个增量添加以下代码

System.Windows.Forms.Application.DoEvents();



如果您运行该应用程序,您将看到进度条没有冻结



希望这有帮助



kumaran

Good people,

I have a quick question. For the screens in my application, before they load, I need to fetch data from the database, perform some calculations, then load it onto the screen. However, rather than the software just freeze up during this process, I would like the progress bar to indicate the, well, progress towards the screen being loaded.

My question is: how do I make the progress bar show the progress during that process of getting data from the database and updating the screen?

Thanks,
Blitz

解决方案

You should check out the BackgroundWorker Component.


I created my ProgressWorker article for exactly this purpose.


Hi
You just design a form containing progressbar control and make the modifier property of progressbar control as public. create intance of the progressbar control form in the main form. set the maximum,minimum and value property values after creating instance. increment the value property during the process and add the following code below for every increment
System.Windows.Forms.Application.DoEvents();

if you run the appliction you will see the progressbar without freezing

hope this helps

kumaran


这篇关于进度条和数据处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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