I'm trying to figure out how to determine best practice when a void method returns for a program I'm working on. Basically the program has a call to a 3rd party grid to tell it to save the contents to an Excel sheet. The method to save the grid is a void method grid.SaveExcel(string filename, ...)
. I was thinking it would require the use of the await
and async
commands but have read in multiple places that this isn't best practice. I'm curious how you would go about doing this correctly as I'm a noob in terms of await
, async
, Lamda, Invoke, Action
, Task
, delegate
stuff in C# and think I'm just confusing myself. I basically know how to open SQL connections, populate a grid, handle button event handlers, build basic classes, etc (very basic stuff).
I basically want to call the grid.SaveExcel
method and then update a progress bar while I'm waiting for the saving of the grid to complete. Once it completes, I want to move on to the next few lines of code. Can someone help point me in the right direction and show me some code to attempt to accomplish this? Thanks in advance!