csharp textbox refresh not working delegate code example

Example: how to invoke textbox from another task in c#

if (progressBar.InvokeRequired)
               {

                   void Invoker()
                   {
                       progressBar.Properties.Maximum = count;


                       progressBar.PerformStep();
                       progressBar.Update();
                   }
                   progressBar.Invoke((MethodInvoker)Invoker);
               }
               else
               {
                   progressBar.PerformStep();
                   progressBar.Update();
               }
               
               
               
 //////////////////////// or
 //Update progress bar in separate task
progressBarControl.Invoke((Action) (() =>
progressBarControl.EditValue = 100));