.net - How to take the result of a method called Asynchronously? -


When I do a long operation to block the UI of my applications that I do:

  public sub ButtonHandler () as action auxDelegate = new action (AddressOf DoAction) auxDelegate.BeginInvoke button is not dimmed auxDelegate handles (AddressOf EndAction, a) End sub Private sub DoAction () '' # long Term operation here sub-private sub-end EndAction () '' # result update sub  end here 

In the case of DoAction take the result that it That is a function rather than sub EndAction to define a class attribute that is a way to use the results of that on the other and there put value example

, if DoAction like this :?

  Private Function DoAction () Return as a Boolean True End Sub  

Is there a way to get the results of DoAction on the and operation?

Thank you in advance!

There is an indicator for the function that does not take any arguments on it and returns no value. If you want your work to return some values, then you have to use a different representative. For example you can use if you want your function to return a Boolean value:

  handles dim auxDelegate function as (Boolean) are public sub ButtonHandler () button auxDelegate = AddressOf DoAction auxDelegate.BeginInvoke (AddressOf EndAction, nothing) end sub Private function DoAction () Boolean return true end function Private sub EndAction as (ByVal ar IAsyncResult as) 'representatives EndInvoke call results dim results on Boolean = auxDelegate. EndInvoke (AR) Received as End Sub The  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -