I’ve developed a user-control class which i intent to use for buttons . After declaring them in my form1 class, i use something like this : inout_button1.click += new EventHandler(but1); to add a handler for the click . all is well till here. from another thread i wish to invoke a method in my form1 class that changes the state of the button (Enabled=true/false, built in the user-control class ) but i am told by the program that i can’t access it from another thread. My question is : Can i make a invoke in my button class and not for every button ? i have some like 14 buttons so it’s kind of uneasy to make a delegate for all of them, one by one ..
I’ve developed a user-control class which i intent to use for buttons . After
Share
You can not amend your UI controls from threads other than UI thread, for this reason there is a work around. Please take a look into this MSDN article