Why cross-thread exception only thrown when you change visible properties of a control?

本秂侑毒 提交于 2021-01-29 15:11:33

问题


I have noticed that if I change a visible property of a control, such as label1.Text, from another thread that did not create the control, Visual Studio will throw an invalid cross-thread operation exception. But if I change a non-visible property of the control, say label1.Name, then no exception is thrown. Why is that?

来源:https://stackoverflow.com/questions/65839267/why-cross-thread-exception-only-thrown-when-you-change-visible-properties-of-a-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!