I use the invoke action method in the form works perfectly)
public void Active(Panel l) { Task.Factory.StartNew(() => { Thread.Sleep(2000); Invoke((Action)(() => { l.Visible = false; })); }); } But I don’t know how to work through the class.
I need to call it through the class in the main form (I use buttons)
PS: When a button is pressed, through the class (where the method is called, something is being done) to notify the user that the method worked normally. I pass the information in the label on the form.
[Update]
On each button I call this method:
Active(panel1); so that the panel after 2 seconds was hidden.
I want the Active method to be transferred to the class, and from there I already assign each button a method
EventHandler- MihailPw