title: Function to Call Async Sub finishing Function Before Async
body: <p>Using HttpClient sub in a DLL.  But the calling app wants to get a True or False as a return that the HttpClient worked.</p>
  
  <p>So I tried to write a simple calling app like so</p>
  
  <pre><code> Public Function SendBasket() As Integer
      Try
          SendMarketBasket()
  
          If MktResp = "Loaded" Then
              Return 0
          ElseIf MktResp = "Nothing to Load" Then
              Return -1
          End If
      Catch ex As Exception
          Return -1
      End Try
  End Function
  
  Private Async Sub SendMarketBasket()........
  </code></pre>
  
  <p>Obviously the If statement after the call to the Async call runs immediately before the MktResp is set.  How can I return the function result only after the Async call completes?</p>
  
  <p>TIA
  Harry</p>