来自背景工作者的文本框文字? [英] Textbox text from background worker?
本文介绍了来自背景工作者的文本框文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图弄清楚如何从后台工作人员中获取文本框的文本或其他属性.有人知道怎么做这个吗?我不能将其作为参数传递,因为它必须是实时的.感谢您的帮助!
I've been trying to figure out how to get my textbox's text or other property from within a background worker. Does anybody know how to do this? I cannot pass it as a param because it needs to be real-time. Thanks for the help!
推荐答案
我认为您只需要调用属性(伪代码)即可:
I think you need to just invoke the property (pseudo-code):
private void bgw1_DoWork(object sender, DoWorkEventArgs e)
{
// looping through stuff
{
this.Invoke(new MethodInvoker(delegate { Text = textBox1.Text; }));
}
}
这篇关于来自背景工作者的文本框文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文