Hi ddanbe, thanks for your answer.
I can the function inside start button like this
await Task.Run(() => MyFunction(filename, cts.Token), cts.Token);
But the processing is done in the function, so I check the number of while loops inside the "while" that is in the function. How can I monitor the number of loops creating the progressbar inside the code of start button?
or when you say, create it in the same thread, is not needed to created inside the same Star button code where I call the "MyFunction()"?
Maybe you can help me with a little example.
Thanks in advance.