在花费时间的过程中显示等待/更新消息 [英] Display Waiting /Updating Message While Time taking process

查看:109
本文介绍了在花费时间的过程中显示等待/更新消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想显示另一个表格,而我将记录更新到数据库可以说需要一段时间,在这段时间内,我想加载一个新表格并说它正在更新数据库或其他内容.我并没有使用background worker.i实际上想显示带有gif的弹出消息,并且仅在更新完成后关闭.它的工作,但当它不显示加载的形式标签和图像清晰.我不能拖动它们像卡住

I I just want to Display a another form while i Updating records to DB lets say it will take a while and during that time i want to load a new form and say its updating DB or something. i did nt use back ground worker.i actually want to display pop up Message with gif and just close from when updation complete. its working but when it did nt show loaded forms lables and images clearly.i cannot drag them its like stuck

frmloading loading = new frmloading();
loading.StartPosition = FormStartPosition.CenterScreen;
loading.Show();
try
{
    //My coding....   
}
loading.Close();
MessageBox.Show("Sucessfully Updated!!!");
dataGridView1.DataSource = "";

推荐答案

报价:

我没有使用后勤工人

这就是问题所在.为了使GUI保持响应状态,您需要在另一个线程中进行长时间的操作.

[更新]
如果您遇到"crss-threading"问题,则MSDN正在等待您(阅读不错): [

That''s the problem. In order Keep the GUI responsive you need to do the long-time-taking operation in another thread.

[update]
If you have ''crss-threading'' issues then MSDN is waiting for you (have a good read): "How to: Make Thread-Safe Calls to Windows Forms Controls"[^].
[/update]


这篇关于在花费时间的过程中显示等待/更新消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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