Application.Update(control) VS control.Update()

0
0

Hello,

I have an async method LoadDataAsync,

in this method I want to show a loader over the DataGridView while the data is loading,

I saw a previous similar question but I wanted to ask more details,

The advised solution is to call Application.Update():

this.dataGridView1.ShowLoader = true;

Application.Update(this.dataGridView1) //Call 

 

But, I saw that we can also call: this.dataGridView1.Update()

 

So which is the correct and recommended approach?

Thanks!

  • You must to post comments
0
0

Hi Ali,

Application.Update () can take any Wisej object as parameter and the result is always the same:
The client syncs with the server. So this is the recommended approach to update the UI after a background task.

The 2nd call is totally unrelated to this and cannot be used as a replacement for the 1st call.

Best regards
Frank

  • Ali Badran
    Okay thanks! 1 thing, Application.Update() is used only in background threads? I’m using it on the main thread since there is a delay and the client isn’t updating the UI directly after the data is fetched, sometimes it require user interaction to refresh the UI.
  • Frank (ITG)
    It depends on where you fetch the data into. Are you using databinding? In general Application.Update() should only be necessary in background threads. Best regards, Frank
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.