小编eAg*_*gle的帖子

跨线程操作无效:从创建它的线程以外的线程访问控制“文本框”

我需要一些帮助。我开始使用 c#,但对事件处理和线程还不是很熟悉。作为一个初学者,随着时间和接触的增加,我想了解更多关于这些高级主题的知识并进行改进,并希望这里的所有人都能帮助我。

我遇到了“跨线程操作无效:从创建它的线程以外的线程访问控制‘名为 stackStatus’的文本框控件”的问题。我一整天都在尝试解决问题,但根本无济于事。我被困住了。:-( 程序遇到异常,无法继续顺利执行。

我已阅读以下主题并尝试了一些事情,但我想我仍然缺少一些东西。如果有人能在这里帮助我,我将不胜感激。谢谢。

跨线程操作无效:从创建它的线程以外的线程访问控制

跨线程操作无效:从创建它的线程以外的线程访问控制“textBox1”

这是代码的大部分部分:

  private void createCloud_Click(object sender, EventArgs e)
    {
        CreateCloud(); //start creation method
        stackStatus.Text = "Creating stack..."; //updates the cloud status textbox
        stackStatus.Refresh();
        Cursor.Current = Cursors.WaitCursor; //change the cursor to wait state
        Start_Describestack(); //call describe method to find out the status of cloud creation progress

        Task.Delay(12000); // wait 12s in case not ready

        Start_Describestack(); // call again describe method to find out the cloud creation progress status
        Cursor.Current = Cursors.Default; //put cursor on …
Run Code Online (Sandbox Code Playgroud)

c# cloud multithreading delegates timer

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

cloud ×1

delegates ×1

multithreading ×1

timer ×1