[不是问题]后台工作人员工作不正常 [英] [Not a question] background worker not working properly

查看:57
本文介绍了[不是问题]后台工作人员工作不正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我在数据库中有120条记录,当我运行我的应用程序时,它会挂起我的应用程序,所以我需要在我的应用程序的后台运行该方法。





请帮帮我....

actually i have 120 records in database when i run my application some time it will hang my application so i need to run that method at background of my application.


please please help me....

推荐答案

你不能从任何其他线程调用当前正在执行的UI的任何实例方法或属性那么UI线程。如果需要从这种非UI线程更新UI,则需要使用UI线程调用机制。请查看我过去的答案:

Control.Invoke( )与Control.BeginInvoke() [ ^ ],

Treeview扫描仪和MD5的问题 [ ^ ]。



我建议永远不要禁用非法跨线程调用的检查。这是不安全的做法。您没有任何严肃的理由使用它。



-SA
You cannot call any instance methods or properties of currently executing UI from any thread other then UI thread. If you need to update UI from such non-UI thread, you need to use UI thread invocation mechanism. Please see my past answers:
Control.Invoke() vs. Control.BeginInvoke()[^],
Problem with Treeview Scanner And MD5[^].

And I would advise to never disable the check for illegal cross-thread calls. This is unsafe practice. You don't have any serious reason to use it.

—SA


http://www.dreamincode.net/forums/topic/88605-the-background-worker/ [ ^ ]



BackgroundWorker类样本初学者 [ ^ ]



也许检查thoose链接..

但下次你可以自己google ^^
http://www.dreamincode.net/forums/topic/88605-the-background-worker/[^]

BackgroundWorker Class Sample for Beginners[^]

maybee check thoose links..
but next time you could google them yourself ^^


这篇关于[不是问题]后台工作人员工作不正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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